Hover in IE not working when hovering over full div(将鼠标悬停在完整的 div 上时,在 IE 中悬停不起作用)
问题描述
I am using jquery addClass code to show/hide elements when rolling over a div. in all browsers it works but in IE it only works when i rollover some text, not the full div.
so in this example, if I rollover the showingtext section of the main div, the hiddentext div will show. but if I mouse into the space in between the two floating divs (where there is now text or anything), the hover doesnt work.
UPDATE: the code below seems to work, but my production code does not. Please refer to this link: jsfiddle.net/H2anm/5 There are some broken images and such, but if you roll your mouse over the element into the whitespace to the right of the usernames, the location coordinates and the Pref.brand: Gamehouse.. or some of the surrounding whitespace of the Share/Bookmark links, the div collapses and the buttons/bgcolor change disappear.
javascript:
$(function() {
$("div.DivThatsTriggeredOnRollover").hover(
function() { $("div.hiddentext").addClass("hiddentextShow"); },
function() { $("div.hiddentext").removeClass("hiddentextShow"); });
});
pseudo-html code:
<div class="DivThatsTriggeredOnRollover" style="width:500px;">
<div id="showingtext" style="float:left;width:100px;">
here is showing text
</div>
<div class="hiddentext" style="float:right;width:100px;">
here is hidden text
</div>
</div>
turns out that in IE7 if you have multiple floats inside of a larger div and you specify a width in one of the inner floating divs, you have to specify a width in the outermost ones as well. im not sure why this is the case, but it has been fixed in the version of my code here: http://jsfiddle.net/H2anm/8/
I needed to specify a width for the entire outer div, since I had specified one for the gray div. prior to that, if I rolled off of the red/gray the hover flip didnt work.
这篇关于将鼠标悬停在完整的 div 上时,在 IE 中悬停不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:将鼠标悬停在完整的 div 上时,在 IE 中悬停不起作用


- 如何显示带有换行符的文本标签? 2022-01-01
- 为什么悬停在委托事件处理程序中不起作用? 2022-01-01
- 使用 iframe URL 的 jQuery UI 对话框 2022-01-01
- 在不使用循环的情况下查找数字数组中的一项 2022-01-01
- 为什么我的页面无法在 Github 上加载? 2022-01-01
- 如何向 ipc 渲染器发送添加回调 2022-01-01
- 如何调试 CSS/Javascript 悬停问题 2022-01-01
- 从原点悬停时触发 translateY() 2022-01-01
- 是否可以将标志传递给 Gulp 以使其以不同的方式 2022-01-01
- 我不能使用 json 使用 react 向我的 web api 发出 Post 请求 2022-01-01