/* If the object is completely visible in the window... */
if( bottom_of_window > bottom_of_object ){
$(this).is(".block-left").addClass('fadeInLeft');
$(this).is(".block-right").addClass('fadeInRight');
}
Я палочку для addClass, проверяя класс элементов, но это, похоже, не работает.
Вы можете использовать hasClass():
if( bottom_of_window > bottom_of_object ){
if($(this).hasClass("block-left")) {
$(this).addClass("fadeInLeft");
} else if($(this).hasClass("block-right")) {
$(this).addClass("fadeInRight");
}
}
.block-left
и .block-right
, а не только к this
.
Вы должны использовать, if
if( bottom_of_window > bottom_of_object ){
if ($(this).is(".block-left")) {
$(this).addClass('fadeInLeft');
} else if ($(this).is(".block-right"))
$(this).addClass('fadeInRight');
}
}
Используйте .hasClass()
if($(this).hasClass("block-left")){
$(this).addClass('fadeInLeft');
}