Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery Overlay Default Positioning
    primarykey
    data
    text
    <p>I have a jquery tools overlay one my wordpress blog, and I have the code that keeps it in position where I want it to be when I resize the window. But on first click to load the overlay, it displays in the center of the page, I need it set to the left an additional 250px. </p> <p>heres my code for the positioning:</p> <pre><code>$(document).ready(function() { setDef() }); function setDef() { var w = $('.simple_overlay').width();//get width of overlay var h = $('.simple_overlay').height(); //get height of overlay var l = ($(window).width() - w) / 2 + 250; //calculate left property var t = ($(window).height() - h) / 2 //calculate top property $('.simple_overlay').css({ 'left': l }) } </code></pre> <p>the above should calculate the default position (centered) then add 250px, but its not adding the 250. The code below adds the 250 when the window is resized.</p> <pre><code>$(window).resize(function() { rePosition() }); function rePosition() { var w = $('.simple_overlay').width();//get width of overlay var h = $('.simple_overlay').height(); //get height of overlay var l = ($(window).width() - w) / 2 + 250; //calculate left property var t = ($(window).height() - h) / 2 //calculate top property $('.simple_overlay').css({ 'left': l }) </code></pre> <p>I think I need to use something other than (document).ready</p> <p>Ps- You can close the overlay by clicking in the top right corner, theres no visual indicator right now but your cursor will change.</p> <p>Any suggestions?</p> <p>Thanks!!!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload