Top Left Text cha

Web & App Development

Just a simple example of how to add or remove a class when you scroll the page.

 <script>

var $jQ = jQuery.noConflict();

          $jQ(window).scroll(function() {
            var scroll = $jQ(window).scrollTop();

            if (scroll >= 5) {
                $jQ(".topWrapper").addClass("topScroll");
            } else {
                $jQ(".topWrapper").removeClass("topScroll");
            }
        });
</script>

 
If this does not work, check for a jQuery conflict by removing the first line:

var $jQ = jQuery.noConflict();

 

...and changing '$jQ' to 'jQuery' (without the quotes).

Add comment


Security code
Refresh

  • No comments found

Leave your comments

Post comment as a guest

0
Your comments are subjected to administrator's moderation.
X