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

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -