What's the difference in selecting the class of these two ways in JQUERY
?
One has access to parameters, another does not, how does it work?
var valor = $(".classe");
var valorAnime = 'classe';
Take a look at this code:
(function(){
let $target =$(".projeto"),
animeStart = 'projeto-anime',
offset = $(window).height() * 3/4;
function animeScroll (){
let documentTop = $(document).scrollTop();
$target.each(function(){
let itemTop = $(this).offset().top;
if( documentTop > itemTop - offset) {
$(this).addClass(animeStart);
} else {
$(this).removeClass(animeStart);
}
})
}
animeScroll();
$(document).scroll(function(){
animeScroll();
});
}());