jQuery的:嵌套标签和悬停()不工作在IE中 [英] jquery: nested tags and hover() not working in IE

查看:128
本文介绍了jQuery的:嵌套标签和悬停()不工作在IE中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的结构:

 < div id =container> 

< span>
< span>< / span>
< / span>

< span>
< span>< / span>
< / span>

< / div>

我需要捕捉容器的mouseout事件,所以我让jquery执行此操作:

  $(#container)。hover('',function(){
alert(Out);
});

在Firefox / Opera中,它只会在离开div
时触发mouseout函数我想要它)。



在IE中,它会在鼠标点击的div内的每个* -Tag处触发鼠标移出功能。
(*也许很重要的是,span标签也有鼠标悬停和跳出事件)

任何人都有一个想法如何解决这个问题?
(嵌套结构不能被更改,因为一个复杂的布局)

thx4任何想法!

解决方案

@evelio:它没有工作,id始终是容器。

我如何解决它(到目前为止...) :

相信与否,container-div的属性background-color必须设置为一种颜色。
im还是很震惊这个事实,但是我尝试了几次,并且只尝试了css中的背景颜色属性,这使得它不管用。



和:颜色#000000不起作用,任何其他颜色,包括白色


i have a construction like this:

<div id="container">

<span>
   <span></span>
</span>

<span>
   <span></span>
</span>

</div>

i need to catch the mouseout event of the container, so i made jquery do this:

$("#container").hover('',function(){ 
alert("Out"); 
});

In Firefox / Opera, it only fires the mouseout-function when leaving the div (how I want it).

In IE it fires the mouseout-function at every *-Tag inside of the div the mouse hits. (*maybe important is, that the span tags have also mouseover and out events)

Anyone has an idea how to solve this? (The nested structure cant be changed because a complex layout)

thx4 any ideas!

解决方案

@evelio: it didnt work, the id was always "container"

how i solved it (so far...):

believe it or not, the attribute background-color of the container-div had to be set in a color. im still quite shocked of this fact but i tryed it several times and its only the background-color attribute in the css that makes it work or not.

and: the color #000000 does not work, any other color does, including "white"

这篇关于jQuery的:嵌套标签和悬停()不工作在IE中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆