2013-03-07 89 views
0

我們通過fieg提供了一個函數「onRenderComplete」的jquery.ias.js。 你可以得到這個在github linkjquery加載滾動功能無法正常工作

我有一個文章列表加載新項目工程相當不錯。 但對於每一個正在生成一個明確的視圖

$("p.ex-[ID]").click(function(){ 
     $(".express-[ID] .top").delay(500).load("/[Name4URL]/a-[ID]/ .express"); 
     $(".express-[ID] .bottom-ex .ex-desc").delay(500).load("/[Name4URL]/a-[ID]/ #tab1.tab_content"); 
     $(".express-container-[ID]").fadeIn(500); 

     window.setTimeout(function() { 
      MagicZoomPlus.refresh("Zoomer2"); 
      $(".mz-thumbs a:gt(3)").addClass("nope"); 
      $(".mz-thumbs a:gt(7)").addClass("nope2"); 

      $(".image-container .mz-thumbs a:eq(3)").addClass("no-margin-right no-margin-top"); 
      $(".image-container .mz-thumbs a:eq(7)").addClass("no-margin-right"); 
      $(".image-container .mz-thumbs a:eq(0)").addClass("no-margin-top"); 
      $(".image-container .mz-thumbs a:eq(1)").addClass("no-margin-top"); 
      $(".image-container .mz-thumbs a:eq(2)").addClass("no-margin-top"); 
     }, 1200); 
    }); 



    $(".express-container-[ID] .close").click(function(){ 
     $(".express-[ID] .top").load("/[Name4URL]/a-[ID]/ .clear"); 
     $(".express-[ID] .bottom-ex .ex-desc").load("/[Name4URL]/a-[ID]/ .clear"); 
     $(".express-container-[ID]").fadeOut(500); 
    }); 

對於無加載項項目的腳本的一部分,這工作正常。但是新裝的物品並沒有開火。 這是jquery.ias部分:

$(document).ready(function() { 
jQuery.ias({ 
    container : ".container", 
    item: ".item", 
    pagination: ".articlePages", 
    next: 'a .next', 
    loader: '<img src=/layout/cyt/img/ajax-loader.gif"/>', 
    triggerPageThreshold: 1, 
    history: false, 
    onRenderComplete: function(items) { 


    } 
}); 
}); 

我試圖執行腳本部分進入onRenderComplete功能,但它不工作,我真的不知道怎麼樣。

回答

0

我相信你應該使用jquery .on()方法http://api.jquery.com/on/。 click方法不適用於動態插入的DOM元素。你應該這樣做:

$("selector-that-contains-p.ex-[ID]").on("click", "p.ex-[ID]", function() {// do the stuff 
});