0

次のページをクリックすると、このコードに問題が発生します>>>ページが2回更新されます。<<<停止することは可能ですか?私の貧弱な英語でごめんなさい

コード

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

どうもありがとう

4

1 に答える 1

1

クリックイベントの伝播を停止する必要があります(これはとは異なります.preventDefault())。

$("a.pager").click(function(event){
  event.preventDefault();
  linkLocation = this.href;
  jQuery(".container").fadeOut(1000, redirectPage);
  return false; // stop propagation of the click event 
});
于 2013-01-12T08:45:24.160 に答える