change the active state on scroll using owl carousel slides as buttons
up vote
0
down vote
favorite
I have page with a sticky owl carousel with the category names on scroll.
I want when i scroll down the page, to change the active state on scroll (to load the 'cat-promo-active' class when I am on the current section)
Here it is the jsfiddle: http://jsfiddle.net/64qjptkf/
I have tried this:
$(window).scroll(function() {
var scrollDistance = $(window).scrollTop();
$('cs-heading').each(function(i) {
if($(this).position().top <= scrollDistance) {
$('.cat-promo').eq(i).addClass('cat-promo-active');
}
})
}).scroll();
not working...all the buttons will load that class.
How can i fix it?
javascript jquery html
add a comment |
up vote
0
down vote
favorite
I have page with a sticky owl carousel with the category names on scroll.
I want when i scroll down the page, to change the active state on scroll (to load the 'cat-promo-active' class when I am on the current section)
Here it is the jsfiddle: http://jsfiddle.net/64qjptkf/
I have tried this:
$(window).scroll(function() {
var scrollDistance = $(window).scrollTop();
$('cs-heading').each(function(i) {
if($(this).position().top <= scrollDistance) {
$('.cat-promo').eq(i).addClass('cat-promo-active');
}
})
}).scroll();
not working...all the buttons will load that class.
How can i fix it?
javascript jquery html
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have page with a sticky owl carousel with the category names on scroll.
I want when i scroll down the page, to change the active state on scroll (to load the 'cat-promo-active' class when I am on the current section)
Here it is the jsfiddle: http://jsfiddle.net/64qjptkf/
I have tried this:
$(window).scroll(function() {
var scrollDistance = $(window).scrollTop();
$('cs-heading').each(function(i) {
if($(this).position().top <= scrollDistance) {
$('.cat-promo').eq(i).addClass('cat-promo-active');
}
})
}).scroll();
not working...all the buttons will load that class.
How can i fix it?
javascript jquery html
I have page with a sticky owl carousel with the category names on scroll.
I want when i scroll down the page, to change the active state on scroll (to load the 'cat-promo-active' class when I am on the current section)
Here it is the jsfiddle: http://jsfiddle.net/64qjptkf/
I have tried this:
$(window).scroll(function() {
var scrollDistance = $(window).scrollTop();
$('cs-heading').each(function(i) {
if($(this).position().top <= scrollDistance) {
$('.cat-promo').eq(i).addClass('cat-promo-active');
}
})
}).scroll();
not working...all the buttons will load that class.
How can i fix it?
javascript jquery html
javascript jquery html
asked 9 hours ago
calin24
11013
11013
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53266019%2fchange-the-active-state-on-scroll-using-owl-carousel-slides-as-buttons%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password