2014-02-13 55 views
2

我在網站上顯示不同類型的圖像。附加到每個圖像我想添加一些文字。我已經把這個文本寫在html文檔的title-element中。這段文字只有幾句話。jQuery:更改花式框寬度

現在發生的事情是,fancybox變得非常狹窄(因爲圖片很小),文字看起來非常愚蠢。我試圖改變fancybox代碼中的寬度和高度值,但它似乎仍然不起作用。我試圖用CSS來修復它,並且我將標題文本變得更寬一些,但是fancybox仍然太窄,所以文本部分在框內和框外。

如何將fancybox大小更改爲固定大小,以便標題文本不會看起來如此愚蠢?

到目前爲止,我已經做到了這一點:

的jQuery:

$(".fancybox").fancybox({ 
    helpers : { 
     title: { 
      type: 'inside', 
      position: 'top', 
     } 
    }, 
      openSpeed: 'slow', 
      closeSpeed: 'slow', 
}); 

CSS

.fancybox { 
    width: 600px; 
    height: 600px; 
} 

.fancybox-title { 
    width: auto; 
    height: auto; 
} 

.fancybox-title .child { 
    min-width: auto; 
    height: auto; 
} 
+0

http://meta.stackexchange.com/a/5235 – JFK

+0

嘿檢查我的回答後「[http://stackoverflow.com/questions/11306587 /using-fancybox-set-height-and-width/41973473#41973473](http://stackoverflow.com/questions/11306587/using-fancybox-set-height-and-width/41973473#41973473)」。 –

回答

3

你需要自動調整大小設置爲false

$(".fancybox").fancybox({'width':400, 
         'height':300, 
         'autoSize' : false});