bosspetta bosspetta - 1 year ago 112
jQuery Question

Add class when scroll down with AlloyUI

I need to add a class when the user scroll down. I usually do this with jQuery:

$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll >= 10) {

How can I do the same thing with AlloyUI?
Really thanks.

Answer Source

Using the ScrollInfo plugin and its scroll event

var body ='body');


body.scrollInfo.on('scroll', function (e) {
    if (e.scrollTop >= 10){'.dockbar').addClass('dockbar-opacity');