Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to keep content of a div always visible despite moving scrollbar down
    primarykey
    data
    text
    <p>I am trying to duplicate the left nav at <a href="http://www.kahuna-webstudio.fr/" rel="nofollow noreferrer">http://www.kahuna-webstudio.fr/</a>. If you take a look at <a href="http://www.kahuna-webstudio.fr/" rel="nofollow noreferrer">http://www.kahuna-webstudio.fr/</a>, and scroll down about 50 pixels or so, you will see a div appear off to the left of the screen that has some navigation in it. I have most of it working, thanks to the help of some of you at stackoverflow. But the one part I do not have working is that the content of my div, images, do not stay stationary in place (or always visible) as you scroll down. </p> <p><strong>So what I want to happen is:</strong> when the div appears at the left of the screen, when the user scrolls down, I want the content of the div to appear always in view.</p> <p><strong>Right now what I have working is:</strong> through animate() I set the height of my left nav div to the document height, and the width grows to 80 pixels, and then some images fadeIn(). But the page is fairly long and as the user scrolls down they are also able to scroll down the height of my left nav div; and I always want the content of my left nav to always appear in view to the user.</p> <p>I think this person posted a similiar question (<a href="https://stackoverflow.com/questions/4559449/keeping-a-header-always-in-view">Keeping a header always in view</a>) but I am finding it difficult to attach if to my example code. Can anyone help? I appreciate it a lot.</p> <p>Here is my code:</p> <pre><code>$(window).scroll(function(){ var wintop = $(window).scrollTop(); var docheight = $(document).height(); var winheight = $(window).height(); var newwidthgrow = 80; var smallheight = 0; var smallwidth = 0; if((wintop &gt; 296)) { $("#slidebottom").stop().animate({height:docheight +"px"},'fast',function(){ $("#slidebottom").stop().animate({width:newwidthgrow + "px"},'slow',function(){ $("#slidebottomContents").fadeIn(); }); }); } if((wintop &lt; 25)) { $("#slidebottom").stop().animate({height:docheight +"px"},'fast',function(){ $("#slidebottomContents").fadeOut(function(){ $("#slidebottom").stop().animate({width:smallwidth + "px"}); }); }); } }); </code></pre>
    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.
 

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