我需要在滚动特定 DIV 之后添加一个 CSS class
I need to add a CSS class just after scrolling of particular DIV
当我滚动到特定的 CLASS 或 DIV.
时,我需要添加 CSS class
您可以试试下面的代码:
require(['jquery'],function($){
$(window).on('scroll', function() {
if($(window).scrollTop() >= $('.bolck-section').offset().top + $('.bolck-section').outerHeight() - window.innerHeight) {
$('.inner-wrapper').addClass('testing');
}
else{
$('.inner-wrapper').removeClass('testing');
}
});
});
当我滚动到特定的 CLASS 或 DIV.
时,我需要添加 CSS class您可以试试下面的代码:
require(['jquery'],function($){
$(window).on('scroll', function() {
if($(window).scrollTop() >= $('.bolck-section').offset().top + $('.bolck-section').outerHeight() - window.innerHeight) {
$('.inner-wrapper').addClass('testing');
}
else{
$('.inner-wrapper').removeClass('testing');
}
});
});