2012-03-07 10 views
0

私はSOに関する類似のトピックを検索しましたが、私のために働いたソリューションはありませんでした。私はAjaxを介して私のページにリンクを設定しています。同様に:ダイナミックリンク上のファンシーボックス

$.post('php/common/auction_view/auction_invoices.php', function(data){ 
    $('#auction-invoices').html(data); 
    //Initiate Fancybox on links 
    $("a.example4").fancybox({ 
      'opacity'  : false, 
      'overlayShow' : false, 
      'transitionIn' : 'elastic', 
      'transitionOut' : 'elastic', 
      'type'   : 'iframe' 
    }); 
}); 

ただし、これは機能しません。誰にも解決策がありますか? Thanx!

EDIT:オーケー、解決策を見つけた:

$.post('php/common/auction_view/auction_invoices.php', function(data){ 
$('#auction-invoices').html(data); 
$.getScript("fancybox/jquery.fancybox-1.3.4.js", function(){ 
    $.fancybox.init(); 
    $("a.example4").fancybox({ 
     'transitionIn'  : 'elastic', 
     'transitionOut'  : 'elastic', 
     'overlayShow'  : false, 
     'showCloseButton' : true, 
     'width'    : 450, 
     'height'   : 585, 
     'titleShow'   : false, 
     'type'    : 'iframe' 
    }); 
}); 

})。

enter code here 
+0

これをバインドしましたか? $( "a.example4")。bind(function(){$(this).fancybox({});});これは問題かもしれません。 – Ohgodwhy

+0

私はそれをajaxコールに入れますか? – Ismailp

答えて

0

Fancybox v1.3.xは動的に追加された要素をサポートしていません。

私は同様のquestion hereに答えました。これは、jQuery .on()メソッドを使用して、動的に追加された要素にfancyboxをバインドします。

のようなあなたのコンテナに合わせて、コードを微調整:この答えは、私を助けていない

$("#auction-invoices").on("focusin", function(){... 
0

、それは複雑にだが、これは(jQueryの1.7.2とfancybox 1.3.4)私を助けたソリューションです。

オープンjquery.fancybox-1.3.4.jsとこのソリューションは、私の問題を解決して、何かを変更する必要がない、でも初期REMラインについて790

このよう
$.fn.fancybox = function(options) { 
    if (!$(this).length) { 
     return this; 
    } 

    $(this) 

     .unbind('click.fb') 
     .live('click.fb', function(e) { 
     $(this).data('fancybox', $.extend({}, options, ($.metadata ? $(this).metadata() : {}))) 
      e.preventDefault(); 

を、それを編集デフォルトのように。

シンプルでクリーンです。希望が役立ちます。

関連する問題