On below I have the scrollTop working and it scrolls up. However I can't scroll back down unless I wait 10 or so seconds. When I inspect it there are multiple click events registered. How do I prevent this from happening? Tried ,return false; one, live, but no luck. Maybe just need a break from looking at it? Thanks for the suggestions.
$(window).on('scroll', function() {
/* PROGRESS BAR */
if ($("div").hasClass("progress-content")) {
if (($(this).scrollTop() + $(this).height()) >= $(".progress-content").offset().top) {
$('.progress-bar').each(function() {
var getPercent = $(this).data('percent') / 100;
var getProgressWrapWidth = $(this).width();
var progressTotal = getPercent * getProgressWrapWidth;
var animationLength = 1500;
$(this).stop().animate({
left: progressTotal
}, animationLength);
});
}
}
/* BACK TO TOP */
if ($(this).scrollTop() != 0) {
$(".back-to-top").fadeIn();
} else {
$(".back-to-top").fadeOut();
};
/* STICKY HEADER */
if ($(this).scrollTop() > stickyHeader) {
$('.sticky-header .header-menu').addClass("sticky");
$('.sticky-header .header .open.category-menu').addClass('closed');
} else {
$('.header-menu').removeClass("sticky");
$('.header .open.category-menu').removeClass('closed');
}
});
$(".back-to-top").click(function() {
$("body, html").animate({
scrollTop: 0
}, 800);
});