I tried to use the code bellow for control element when scroll, "if" and "else" are work but "if else" not working, please tell me why, Thanks!
$(document).ready(function() {
var offset = 900;
var duration = 2000;
$(window).scroll(function() {
if( $(this).scrollTop() > offset ) {
$('.icon_circle').css("top", "138px");
$('.row2 .col-left img').css("border", "1px solid red");
} else if( $(this).scrollTop() > offset + 100 ) {
$('.icon_circle').css("top", "168px");
} else {
$('.icon_circle').css("top", "0");
$('.row2 .col-left img').css("border", "none");
}
});
});
Aucun commentaire:
Enregistrer un commentaire