Posted By

onefastsnail on 05/24/12


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

hurcy


link jump


 / Published in: JavaScript
 

  1. <script>
  2. $(function(){
  3. $(".jump").on("click", function(e){
  4. e.preventDefault();
  5. to = $(this).attr("rel");
  6. target = $($(this).attr("href")).offset();
  7. $('html,body').animate({scrollTop: target.top}, 1000);
  8.  
  9. });
  10. });
  11. </script>
  12.  
  13. <!-- class jump activates it as a jump link, rel contains id of area to jump to -->
  14. <a href="#eol" class="jump" rel="eol">Home</a>

Report this snippet  

You need to login to post a comment.