When I click anywhere on the site, it does the scrolling animation for the #text_text_position.
How to make it so that only when you click on the element do the animation?
$(window).on("resize click",function(){
$('html, body').stop();
var abas = $(this).width() <= 800 ? "#texto_posicao" : ".abas";
$('html, body').animate({scrollTop: $(abas).offset().top}, 300);
$("#texto_posicao").addClass("classecss");
var lastScrollTop = 0;
$(window).on('scroll', function() {
var st = $(this).scrollTop();
if(st < lastScrollTop) {
$("#texto_posicao").removeClass("classecss");
}
lastScrollTop = st;
});
});
html
<div class="abas abas1" tabindex="1">
Planejamento Estratégico
</div>
<div class="abas abas2" tabindex="2">
Mentoria Food Service
</div>
<div class="abas abas3" tabindex="3">
Terceirização Financeira
</div>
<div class="abas abas4" tabindex="4">
Marketing Full Time
</div>
<div class="abas abas5" tabindex="5">
Mastermind
</div>
<br clear="all" /><br />