So I tried to change my .products
whenever it was between #trigger-start
and #trigger-end
, I created this jQuery file but for some reason it doesn't work quite good. The alerts do work whenever I enable them tho.
jQuery
var scrollFilter1 = $('#trigger-start').offset().top;
var scrollFilter2 = $('#trigger-end').offset().top;
var windowPosY = $(this).scrollTop();
$(window).scroll(function(){
if(windowPosY >= scrollFilter1 && windowPosY <= scrollFilter2){
//alert('yey');
$('.products').css('opacity','0.6');
} else {
//alert('ney');
$('.products').css('opacity','1');
}
});
And yes the 2 divs (trigger-start --end are placed in html and styled in css)