jQuery fadeOut不会更改显示属性 [英] jQuery fadeOut is not changing display property
问题描述
在 http://judi.simpleupdates.com/上,我试图对图像进行幻灯片显示使用jQuery fadeIn
和fadeOut
效果的页面.两项fadeIn
都没有问题.但是,fadeOut
不会更改应该消失的div
的display
属性.为什么这可能无法按预期工作的任何想法?
On http://judi.simpleupdates.com/ I am attempting to make a slideshow of images on a page using the jQuery fadeIn
and fadeOut
effects. Both items fadeIn
without issue. However, fadeOut
is not changing the display
property of the div
that is supposed to disappear. Any ideas why this might not be working as expected?
这是失败的行:
$( ".carousel_item:nth-child(" + selected + ")" ).fadeOut(600);
更新:问题似乎出在没有width
和height
的元素上的fadeOut
.当将值添加到div.carousel_item
的width
和height
属性时,fadeOut
调用将正常工作.另一种方法是从后代img
中删除position: absolute
,从而导致div
增长到img
尺寸.
UPDATE: The issue seems to be with fadeOut
on a element that does not have a width
and height
. When values are added to the width
and height
properties of div.carousel_item
the fadeOut
call works properly. Another method is to remove position: absolute
from the descendant img
causing the div
to grow to the img
dimensions.
推荐答案
问题似乎出在没有width
和height
的元素上的fadeOut
.当将值添加到div.carousel_item
的width
和height
属性时,fadeOut
调用将正常工作.另一种方法是从后代img
中删除position: absolute
,从而导致div
增长到img
尺寸.
the issue seems to be with fadeOut
on a element that does not have a width
and height
. when values are added to the width
and height
properties of div.carousel_item
the fadeOut
call works properly. another method is to remove position: absolute
from the descendant img
causing the div
to grow to the img
dimensions.
感谢您的所有帮助和建议!
thanks for all of your help and suggestions!
这篇关于jQuery fadeOut不会更改显示属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!