2013-10-15 50 views
0

...很抱歉,但我有一個類似的問題無解:無法顯示的fancybox冠軍V2

我使用此代碼從一個iframe中打開的fancybox。 這裏頭部分:

<!-- Add jQuery library --> 
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> 

<!-- Add fancyBox --> 
<link rel="stylesheet" href="fancybox/source/jquery.fancybox.css?v=2.1.5" type="text/css" media="screen" /> 
<script type="text/javascript" src="fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script> 

附上的fancybox使用此代碼:

<!-- Attach fancyBox when the document is loaded. --> 
<script> 
/* <![CDATA[ */ 
$(document).ready(function() { 
$('.fancybox').click(function(e){ 
    e.preventDefault(); 
    parent.$.fancybox({ 
     href: this.href, 
     width: 1280, 
     height: 1000, 
     padding: 10, 
     type: 'iframe', 
     scrolling : 'no', 
     openEffect : 'fade', 
     closeEffect : 'elastic', 
     helpers: { 
      title : { position : 'bottom', type : 'float' }, 
      overlay: { css : { 'background' : 'rgba(0,0,0,0.8)' } 
      }, // overlay 
     } // helpers 
    }); // fancybox 
}); // click 
}); // ready 
/* ]]> */ 
</script>  

的身體部分的鏈接如下:

<a title='Sample title' class='fancybox' href='1_BIG.php'> 
<img src="image.jpg" width="100" height="100"> 
</a> 

但是,沒有標題顯示。 :(

當我寫了下面的行附加代碼,標題被顯示出來,只是靜,這有助於什麼?

title : 'just a static title', 

可能有人請幫我

+0

您能夠通過位置沒有影響:「底部」通過標題選項? –

回答

0

既然你使用手工方法燒製的fancybox $('.fancybox').click()然後title屬性不強,因此,你需要迫使它加入API選項

title: this.title 

JSFIDDLE

注意:標題type: 'float'是默認的,並且總是在的fancybox的底部,所以它定位具有

helpers: { 
    title: { 
     // position: 'bottom', // <== useless if using "float" 
     type: 'float' // this is default so you don't have to set it unless is different 
    }, 
    ... 
+0

嗨JFK ... ...並非常感謝您的完美答案。你不知道我試圖找出問題多久。你在哪裏找到這些信息?我想我讀了整個花哨盒的文件,但似乎我錯過了這部分... 無論如何:再次感謝你! – markus