Title: Simple Javascript question
Last modified: August 31, 2016

---

# Simple Javascript question

 *  [dcxs](https://wordpress.org/support/users/dcxs/)
 * (@dcxs)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/simple-javascript-question/)
 * Could someone please explain this piece of code for me:
 * `var bottomPos1 = $('#top-slider').outerHeight(true)-$("#main-header").height()-
   15;`
 * I want to change the position.
 * Its for the placement of a image on my home page, but im not good with JS so 
   I dont know what to do to change the position of my image.

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Thread Starter [dcxs](https://wordpress.org/support/users/dcxs/)
 * (@dcxs)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/simple-javascript-question/#post-7264443)
 * This also seems related:
 *     ```
       $("#top-slider").append('<img class="stamp">');
           $(".stamp").attr("src",templateDir+"/img/Klarna_stamp.png");
       ```
   
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [9 years, 11 months ago](https://wordpress.org/support/topic/simple-javascript-question/#post-7264449)
 * > var bottomPos1 = $(‘#top-slider’).outerHeight(true)-$(“#main-header”).height()-
   > 15;
    - Get the height of the slider (a)
    - Get the height of the header (b)
    - Subtract the height of the slider (a) from the height of the header (b)
    - Subtract 15 from the total sum (c)
 *     ```
       (a - b) - c
       ```
   
 *  Thread Starter [dcxs](https://wordpress.org/support/users/dcxs/)
 * (@dcxs)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/simple-javascript-question/#post-7264452)
 * Thank you! Never would have guessed that. So if I wanted to move the position
   upward, how would I go about doing that?
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [9 years, 11 months ago](https://wordpress.org/support/topic/simple-javascript-question/#post-7264453)
 * You can change the height of the header, change the height of the slider or modify
   that code. Or rewrite your own.
 *  Thread Starter [dcxs](https://wordpress.org/support/users/dcxs/)
 * (@dcxs)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/simple-javascript-question/#post-7264455)
 * I see, I guess in this case Im not sure where the #main-header is located. I 
   have only done PHP and CSS programming before.
 * I cant find the #main-header in the JS file atleast.
 *  Thread Starter [dcxs](https://wordpress.org/support/users/dcxs/)
 * (@dcxs)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/simple-javascript-question/#post-7264457)
 * I think I dont want to change the #main-header, because it might effect other
   things on the site. I just wish there was a simpler way to write the code.
 *  Thread Starter [dcxs](https://wordpress.org/support/users/dcxs/)
 * (@dcxs)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/simple-javascript-question/#post-7264460)
 * Actully playing with the code this seems to be the only relevant code:
 *     ```
       $("#top-slider").append('<img class="stamp">');
       $(".stamp").attr("src",templateDir+"/img/Klarna_stamp.png");
       ```
   
 * So I wrote the wrong code in the beginning. So how can I move the image further
   up with this code?
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [9 years, 11 months ago](https://wordpress.org/support/topic/simple-javascript-question/#post-7264462)
 * Position further up.. We need to see the page you’re talking about.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Simple Javascript question’ is closed to new replies.

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 2 participants
 * Last reply from: [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/simple-javascript-question/#post-7264462)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
