2011-12-07 82 views
1

我有這個簡單的html代碼:的fancybox 2問題打開HTML頁面

<p><a class="doc" href="ajax_content.html">Test</a></p> 

和這個JavaScript

$('a.doc').fancybox({'autoDimensions':false, 'width':'60%', 'height':'70%', 'titleShow':false}); 

這部作品中的fancybox 1.x的罰款,但在第2版,它返回:

The requested content cannot be loaded. Please try again later. 

回答

0

你將不得不使用iframe爲:

 
    $(".doc").fancybox({ 
     'width'    : '75%', 
     'height'   : '75%', 
     'autoScale'   : false, 
     'transitionIn'  : 'none', 
     'transitionOut'  : 'none', 
     'type'    : 'iframe' 
    }); 
+0

iframe是不是最適合我。我需要加載沒有html結構的代碼片段 – max

0

請試試這個:

HTML:

<p><a class="doc fancybox.ajax" href="/absolute/path/to/ajax_content.html">Test</a></p> 

JS部分:

$('a.doc').fancybox(); 
+0

autoDimensions不是Fancybox v2.x選項,而是使用autoSize代替;另外你需要在服務器上測試你的代碼。 Fancybox無法找到本地運行的ajax內容。 – JFK