0
I want you to click on some of the links in the menu of my site, run scrollTop.
$(document).ready(function() {
$(".menu-topo a").click(function() {
$('html, body').animate({
scrollTop: (400)
}, 2000);
});
});
It turns out that the effect is happening before and soon after changes page, what I really want is when I click on some of the links that is in the menu, the page click and then the effect happens.
put this function on the pages q wants the effect, and take the
animate
from within theclick
– periotto
Is the content AJAX or redirects? If it is redirected, you have to take the "click" event, and rotate when you load the page
– Lucas
is by redirecting even, and how do I do this Lucas ? my knowledge is still limited in Jquery
– Sérgio Machado
Guy like I said, select the pages on q you want the animation to be performed and put your
animate
within the$(document).ready()
of this page. So when this page loads will perform the animation– periotto
but in that case the effect will happen twice, when I click it will start and will be interrupted, and as I am using Wordpress by default is already on all pages the same code
– Sérgio Machado
The page
menu
does not need any function. Create a file.js
for the pages q wants this animation and take the eventclick
– periotto
Look at this here. http://answall.com/questions/30703/volta-homeda-p%C3%A1gina
– Marconi
Just put that
animate
out of theclick
and see if that’s what you want, because then it will run when load the page– Lucas
Well did I took event clicking with the mouse and put inside a wordpress function that checks if this on the home page. With this any page other than the home page will receive the effect of sliding a few pixels below. <? php wp_reset_query(); if (!is_home()) { ? > <script type="text/javascript"> $(Document). ready(Function() { $('html, body').Animate({ scrollTop: (200) }, 1000); }); </script> <? php } Else { ? > <? php } ?>
– Sérgio Machado