Timeline for Scroll to an element with jQuery
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 12, 2018 at 14:27 | comment | added | bubencode |
To make it more universal and to remove unnecessary placing of hashtag into browser link window I just tweaked the code as below: jQuery(document).ready(function($) { $(document).on( "click", 'a[href^="#"]', function( e ) { e.preventDefault(); var target = this.hash, $target = $(target); $('html, body').stop().animate({ scrollTop: $target.offset().top - 100}, 1000); }); });
|
|
S Aug 16, 2016 at 5:08 | history | suggested | Al Foиce ѫ | CC BY-SA 3.0 |
Convert code example to snippet
|
Aug 16, 2016 at 3:32 | review | Suggested edits | |||
S Aug 16, 2016 at 5:08 | |||||
S Jul 22, 2015 at 15:26 | history | suggested | CommunityBot | CC BY-SA 3.0 |
http://jsfiddle.net/djtoa1ae/
|
Jul 22, 2015 at 14:35 | review | Suggested edits | |||
S Jul 22, 2015 at 15:26 | |||||
Jul 18, 2014 at 18:06 | history | answered | davidcondrey | CC BY-SA 3.0 |