2011-12-27 144 views
0

我有一個.big容器(width: 100%; height: 100%; overflow: hidden;),並且在這個.container(width: 982px; height: 100%; overflow: hidden;)中。將背景圖像設置爲鏈接?

我想設置它,以便當有人點擊無內容(.content)的.big-container(background)時,放棄fx。 www.google.hu

這裏是圖片:(灰色部分點擊)

enter image description here

如何做到這一點? (也許與jQuery)。

回答

2

使用jQuery ..

$(".big-contaner").click(function(event){ 
    event.stopPropagation(); 
    // do something 
}); 

你需要event.stopPropagation()定製(從。大容器不同)點擊子元素,例如。內容等

+0

HTTP內部事件同治:// dockyardlan.com/請檢查。當我點擊.container上的一個空間時,它是免費的(所以沒有任何圖像,文字),它也讓我感到無聊。問題? :S($( '大容器')上單擊(功能(事件){ \t \t event.stopPropagation(); \t \t location.href = 'http://alienware.hu'; \t}) ;) – Skylineman 2011-12-27 13:28:22

+0

我試圖用FF 9.0重現它,但我只能通過點擊灰色區域來重定向。你使用什麼瀏覽器? – Salaros 2011-12-28 13:48:28

+0

試了很多。解決方法:$( '大容器 ')點擊(函數(事件){ \t \t如果(event.target ==本){ \t \t \t window.open(' http://alienware.hu', '_blank'); \t \t} \t}); – Skylineman 2011-12-29 14:52:49