I'm trying to toggle the width of my pagination on scroll but the toggle seams to be looping and it grows and shrinks over and over once the scroll trigger is hit.
I'm looking for the pagination menu to grow out like a shelf at my scroll point. and hide when you reach back to the top section of the site. – alcoven 16 secs ago edit
My JS
$(window).on('scroll', function() {
var y_scroll_pos = window.pageYOffset;
var element_in_view = y_scroll_pos > activation_point;
var has_reached_bottom_of_page = max_scroll_height <= y_scroll_pos && !element_in_view;
if(element_in_view || has_reached_bottom_of_page) {
$('ul.pagination').animate({
width: 'toggle'
}, 350);
}
else {
$('ul.pagination').animate({
width: 'toggle'
}, 350);
}
});