Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can do this with three pieces of information: the height of the window, how far the window has scrolled down, and how tall the panel is.</p> <p>Simply put, have the panel be <code>position:static</code> to begin. As soon as the window has scrolled down such that <code>windowScroll + windowHeight &gt;= panelHeight</code>, set the panel to <code>position:fixed</code> with its <code>top</code> at <code>windowHeight - panelHeight</code> so that the panel is moved off the screen entirely except for an amount equal to the height of the window. Edit: misread your question a little bit: don't use <code>windowHeight - panelHeight</code>, use the amount of the panel you want to show when the user scrolls past it.</p> <p>Listen to the window's (or document's, might have to test that) <code>onscroll</code> event to tell you when to recalculate the panel's state. To keep IE7 and IE8 from choking (they send far too many <code>onscroll</code> events), either use a timeout to emulate listening to the <code>onscroll</code> event or deregister your listener for ~50-500ms (depending on complexity) after each calculation.</p> <p>Note: getting viewport height can be <a href="https://stackoverflow.com/questions/4976936/get-the-available-browser-window-size-clientheight-clientwidth-consistently-ac">a little tricky</a>. For figuring out how far it has been scrolled, try <a href="http://api.jquery.com/scrollTop/" rel="nofollow noreferrer">$(window).scrollTop()</a> or equivalent. As for the panel height, keep in mind browser differences between height, innerHeight, and outerHeight (or use a library that provides browser-independent access to this value, which I believe jQuery does).</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.
    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