Переключатель страниц Jquery

У меня проблема с этим кодом, когда я нажимаю на следующую страницу >>> страница обновляется два раза.<<< Его можно остановить? извините за мой плохой английский

Код

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;
}});

Спасибо большое

1 ответ

Решение

Вы должны остановить распространение события click (которое отличается от .preventDefault()):

$("a.pager").click(function(event){
  event.preventDefault();
  linkLocation = this.href;
  jQuery(".container").fadeOut(1000, redirectPage);
  return false; // stop propagation of the click event 
});
Другие вопросы по тегам