0
What’s the difference in selecting the class of these two ways in JQUERY
?
One has access to parameters, other not, how it works ?
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();
});
}());
Take a look at the code I added. I understood his explanation, but the way this code is he has access to the project-anime class that is in css and the function is executed without errors, if I select the class the same way I selected the first, error. I can not understand precisely this second form that was used to select the class.
– Hugo Uraga
I edited my answer to fit the question, I hope it was clear and you understood what is happening
– Um Programador
yes, yes. thank you!
– Hugo Uraga