2011-12-27 176 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