Scroll Top only firing on browser resize - not scrolling

50
May 26, 2018, at 00:10 AM

Hi Wondering if you help me.

My scroll to top button only firing/displaying on browser resize - not scrolling down the page

jquery

jQuery(window).scroll(function() {
    if (jQuery(document).scrollTop() > 300) {
        jQuery('.scroll-up').addClass('scroll-top-show');
        } else {
        jQuery('.scroll-up').removeClass('scroll-top-show');
    }
});
jQuery('a[href^="#totop"]').on('click', function() {
        jQuery('html,body').animate({scrollTop: 0}, 2000);
});

css

.scroll-top-show {
    visibility: visible;
    opacity: 1;
}

html

<div class="scroll-up">
    <a href="#totop"><i class="fa fa-angle-up"></i></a>
</div>
READ ALSO
Dynamic routing with static JSON in Vuejs

Dynamic routing with static JSON in Vuejs

I have a static local JSON file which includes my contentI am using VueResources and VueRouter

25
Looping through chunked elements

Looping through chunked elements

I have 3 divs (col-md-4) and I have div blocks inside themI am trying to get the elements by rows (as if the parent was one col-md-12 rather than their divided col-md-4s) but I couldn't figure out how to achieve it

32
scope inside a function of a object?

scope inside a function of a object?

"this" gives myCar object reference inside logColor function but gives window object reference inside the func function why?

31
Repeat partial view Jquery + MVC 5

Repeat partial view Jquery + MVC 5

I have a button that calls a partial view in which a table is loaded with all the categories of my system

58