[英]Simple javascript fading effect not working in IE7/8, fine in other browsers
See http://jonesonter.notomato.com.au/ . 参见http://jonesonter.notomato.com.au/ 。
I have a simple fading effect written when you hover on some list elements positioned over a stack of images which are all absolutely positioned on top of each other. 当您将鼠标悬停在位于一堆图像上的某些列表元素上时,我会写出一个简单的淡入淡出效果,这些图像都绝对位于彼此的顶部。
$("#homeNav li").hover(function(){
//make a variable and assign the hovered id to it
var elid = $(this).attr('id');
//hide the image currently there
$("div#homeImages div").hide();
//fade in the image with the same id as the selected buttom
$("div#homeImages div#" + elid + "").fadeIn("slow");
});
However it won't work in internet explorer. 但是,它在Internet Explorer中不起作用。
I have tried searching around, but can't find a simple fading technique that will let me; 我已经尝试过搜索,但是找不到一种简单的淡入淡出的技术。 have a stack of images position a set of controls (in this case < li> elements) when you hover over a particular control one of the images fades in, the others should all be hidden, the current one should fade out.
将一堆图像放置在一组控件(在本例中为<li>元素)上,当您将鼠标悬停在特定控件上时,其中一个图像会淡入,其他图像都应隐藏,而当前图像应淡出。
IE always seems to have an error and not fade properly. IE似乎总是有错误并且不能正确消失。 Does anyone know where I am going wrong?
有人知道我要去哪里错吗?
A few shots in the dark, I am going home to bed now :) 在黑暗中拍了几枪,我现在要回家睡觉了:)
<div>
directrly inside the element to be faded. <div>
。 Can you try adding this to each image? zoom: 1
CSS property) zoom: 1
CSS属性)会发生什么? the following works for me (html changes): 以下对我有用(更改html):
<div id="homeImages">
<div style="display: none; width:950px; height:500px; background:url('http://jonesonter.notomato.com.au/wp-content/themes/jonesonter/img/home-page/conditioned.jpg');" id="homeConditioned"></div>
<div style="display: none; width:950px; height:500px; background:url('http://jonesonter.notomato.com.au/wp-content/themes/jonesonter/img/home-page/guided.jpg');" id="homeGuided"></div>
<div style="display: block; width:950px; height:500px; background:url('http://jonesonter.notomato.com.au/wp-content/themes/jonesonter/img/home-page/informed.jpg');" id="homeInformed"></div>
<div style="display: none; width:950px; height:500px; background:url('http://jonesonter.notomato.com.au/wp-content/themes/jonesonter/img/home-page/shaped.jpg');" id="homeShaped"></div>
<div style="display: none; width:950px; height:500px; background:url('http://jonesonter.notomato.com.au/wp-content/themes/jonesonter/img/home-page/sustained.jpg');" id="homeSustained"></div>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.