APPAPA
APPAPA

Reputation: 25

Disable div class using JavaScript, enable it on user scroll

How can I disable .ssk-sticky on launch of website, then have it enabled upon user scroll.

I am using Social Share Kit API and have tried changing CSS display property to none, although this kills the social nav, so wondering if it can be done using JavaScript.

$(window).scroll(function () {
    if ($(this).scrollTop() > 100) {
        $('.ssk-sticky').fadeIn();
    } else {
        $('.ssk-sticky').fadeOut();
    }
});

Upvotes: 0

Views: 123

Answers (1)

Ehsan
Ehsan

Reputation: 12959

try this :

<script>
    $(window).scroll(function () {
        if ($(document).scrollTop() > 100) {
            $('.ssk-sticky').fadeIn();
             } else {
                $('.ssk-sticky').fadeOut();
                 }
             });
</script>

Upvotes: 1

Related Questions