2012-08-24 137 views
2

我需要一點幫助。 這裏我需要從fancybox iframe http://squaretwo.ru/pashokk中刪除白色邊框。如何從Fancybox 2中刪除邊框?

您可以通過單擊紅色按鈕來調用fancyBox。 我讀過以前的文章,但無法解決問題。有任何想法嗎?

+1

嘗試將css填充更改爲0 - 對於該塊http://squaretwo.ru/pashokk/fancybox/source/jquery.fancybox.css?v=2.1.0 – 2012-08-24 08:17:24

回答

4

您可以通過將其添加到樣式表中來刪除它。

您的iFrame的結構是這樣的,

<body style="overflow-x: hidden; "> 
    <div style="max-width:550px; border: solid 15px #cc0033;" border="1"> 
     . 
     . 
     . 
    </div> 
</body> 

這樣可以去掉像這樣的邊界,

body div:first-child { 
    border: 0 !important; 
} 

但是,這會影響你給你的#header任何邊框屬性,因爲那也是一個div:first-child

所以請爲div#header邊框屬性做一個!important(如果需要)。

編輯

既然你想擺脫的fancybox背景。

你需要添加這個,

.fancybox-skin { 
    background: transparent; 
    box-shadow: none !important; 
} 

這是由插件生成的默認類。

此外,

如果你只想要紅色邊框內的背景,然後不添加上述html CSS,添加下面添加以下

html{ 
    background: white; 
} 

body div:first-child { 
    background: white !important; 
} 
+0

我認爲我的問題有點不正確。我需要保持紅色的邊框,並刪除Fancybox的白色框架。添加完代碼後,只有紅色邊框消失。 http://jsfiddle.net/fU54x/我認爲這是我的問題的解決方案,但對我來說,它不適用於iframe。 – user1621887

+0

好吧,我會適當地編輯我的答案 –

+0

完全適合我。感謝您的幫助。 – user1621887

4

當調用花哨框腳本時,您還可以設置padding:0作爲選項。 在您的JavaScript腳本:

jQuery(document).ready(function($) { 
    $("a.fancybox").fancybox({ 
     padding: 0 
    }); 
}); 

在那裏你沒有填充。