0
When I click anywhere on the site, it makes the animation scrolling to the div #texto_position.
How to make so that only when you click on the element make 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 />
Dude, you put the event click on
window
, then you practically set the click on the whole window, you have to put in a specific element– Leandro RR
Wagner, post your HTML to make it easier to help. But basically just put the tab element in place of
html,body
inanimation
but post your HTML for easy analysis.– Jorge.M
is in the answer the html
– Wagner Martins Bodyboard