Hy, I'm trying to combine these condition:
$(window).scroll(function() {
if ($('#box2').isOnScreen() == true){
$('#b2').css('opacity', '1')}
else{$('#b2').css('opacity', '0')};
});
$(window).scroll(function() {
if ($('#box3').isOnScreen() == true){
$('#b3').css('opacity', '1')}
else{$('#b3').css('opacity', '0')};
});
I tried something like that:
$(window).scroll(function() {
if ($('.box').isOnScreen() == true){
$(this).css('opacity', '1')}
else{$(this).css('opacity', '0')};
});
but it don't work
my html look likes this
<div id="box2" class="box"></div>
<div id="box3" class="box"></div>
Thanks
Aucun commentaire:
Enregistrer un commentaire