Created
October 30, 2015 09:35
-
-
Save levantoan/85d6522c2693fabed865 to your computer and use it in GitHub Desktop.
Scroll to element to active
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
$(window).scroll(function(){ | |
var window_top = $(window).scrollTop(); | |
var div_top = $(".number_counter").offset().top + 50; // Change class .number_counter | |
var window_height = $(window).height(); | |
if (window_top + window_height >= div_top) { | |
//Code here | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment