简体   繁体   English

IE7中的jQuery Hover问题

[英]jQuery Hover Problems in IE7

I have an image that, when hovered over, should display another image with 4 absolutely positioned links. 我有一个图像,当悬停在上面时,应该显示另一个带有4个绝对定位链接的图像。 This code works in Chrome, Firefox, Safari, and all versions of IE except IE7. 此代码适用于Chrome,Firefox,Safari和除IE7之外的所有IE版本。 Any help with IE 7? 有关IE 7的任何帮助吗?

Here's the JS Fiddle: http://jsfiddle.net/derekbrown/2qVK2/21/ 这是JS小提琴: http//jsfiddle.net/derekbrown/2qVK2/21/

Thanks in advance! 提前致谢!

The problem here is that the initial image is still taking up space on the page despite setting opacity to 0. This can be seen by editing the line which sets the image to opacity 0 to 1; 这里的问题是尽管将不透明度设置为0,但初始图像仍占用页面上的空间。这可以通过编辑将图像设置为不透明度0到1的线来看出。 when hovered both images will be shown side by side. 当悬停时,两个图像将并排显示。

You need to somehow remove the initial image from the document flow on hover. 您需要以某种方式在悬停时从文档流中删除初始图像。 This is normally done by setting the display property to none. 这通常通过将display属性设置为none来完成。 I've updated the jsfiddle to show this in action but the animation is totally smooth. 我已经更新了jsfiddle来显示这个动作,但动画非常流畅。 Ill edit my answer I can improve on its implementation 生病编辑我的答案我可以改进它的实施

http://jsfiddle.net/2qVK2/19/ http://jsfiddle.net/2qVK2/19/

EDIT: This is better, sets the width, animation is much smoother. 编辑:这是更好的,设置宽度,动画更顺畅。

http://jsfiddle.net/2qVK2/20/ http://jsfiddle.net/2qVK2/20/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM