I have a problem with this code when I click on the next page>>>a page refresh two times.<<< Its possible to stop? sorry for my poor english
Code
jQuery(document).ready(function() {
$(".container").css("display", "none"); $(".container").fadeIn(1000); $("a.pager").click(function(event){ event.preventDefault(); linkLocation = this.href; jQuery(".container").fadeOut(1000, redirectPage); }); function redirectPage() { window.location = linkLocation; }});
Thanks very much
You need to stop propagation of the click event (which is different from .preventDefault()
):
$("a.pager").click(function(event){
event.preventDefault();
linkLocation = this.href;
jQuery(".container").fadeOut(1000, redirectPage);
return false; // stop propagation of the click event
});