Last active
November 11, 2016 08:34
-
-
Save gagimilicevic/c0fabee3546046fae8fcbfee49fb8e08 to your computer and use it in GitHub Desktop.
Scroll to element with specific class - jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function () { | |
$( all_items ).each( function( index ) { | |
if( $( this ).attr( 'class' ) == 'active' ) { | |
$('html, body').animate({ | |
scrollTop: $( this ).offset().top - 120 | |
}, 500); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment