jquery - how to create floating internal links container -


i trying create page internal jumper links jump particular anchor tags or header tags within same page..

i want jumper links fixed on top being scrolled by, , scroll footer reaches footer..

and want scroll particular link without page refreshing click of quick links..

also want highlight current anchor link being scrolled..

i tried this, here came with..

function gotobyscroll(hash) { $(document.body).animate({     'scrolltop':   $(hash).offset().top }, 500);    }   var $links = $('#links');  var $content = $('#content');  height = $(window).height();   $(window).scroll(function(){  if ($(window).scrolltop() >= height ){      $links.css({ position:'fixed', top:'70px'});     $content.css({ marginleft: '80px'});  } else {      $links.css({ position:'relative'});     $content.css({ marginleft: '9px'});  }  }); 

//http://jsfiddle.net/mfs3j/13/

basically want create galaxy s4 review - verge

you can use jquery waypoint plugin http://imakewebthings.com/jquery-waypoints/

with plugin can trigger event whenever top (or bottom) of window reaches element.

e.g.

$('#id_of_container').waypoint(function(direction) {   if(direction=='down'){     $(this).css('position','fixed');   } else {     $(this).css('position','');   } }); 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -