javascript - How to keep content of a div always visible despite moving scrollbar down -


i trying duplicate left nav @ http://www.kahuna-webstudio.fr/. if take @ http://www.kahuna-webstudio.fr/, , scroll down 50 pixels or so, see div appear off left of screen has navigation in it. have of working, of of @ stackoverflow. 1 part not have working content of div, images, not stay stationary in place (or visible) scroll down.

so want happen is: when div appears @ left of screen, when user scrolls down, want content of div appear in view.

right have working is: through animate() set height of left nav div document height, , width grows 80 pixels, , images fadein(). page long , user scrolls down able scroll down height of left nav div; , want content of left nav appear in view user.

i think person posted similiar question (keeping header in view) finding difficult attach if example code. can help? appreciate lot.

here 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 > 296)) {     $("#slidebottom").stop().animate({height:docheight +"px"},'fast',function(){       $("#slidebottom").stop().animate({width:newwidthgrow + "px"},'slow',function(){         $("#slidebottomcontents").fadein();       });      });   }    if((wintop < 25))   {      $("#slidebottom").stop().animate({height:docheight +"px"},'fast',function(){        $("#slidebottomcontents").fadeout(function(){         $("#slidebottom").stop().animate({width:smallwidth + "px"});                                              });      });     }   }); 

as far i'm concerned can covered css. keep div in same position can apply following css:

css:

div id { position: fixed; left: 0px width: 'your width' } 

position fixed freezes div in position want. left keeps div positioned on left side of page.

does answer question , solve problem? if not let me know!


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo