jquery fade 元素不显示样式为“可见性:隐藏”的元素
我有一堆缩略图,我正在使用 visibility:hidden;
样式加载这些缩略图,以便它们都保持正确的布局。页面完全加载后,我有一个 jquery 函数可以使它们淡入。当它们的样式设置为 display: none;
时,这是有效的,但显然布局当时就搞砸了。有什么建议吗?
这是淡入淡出线:
$('.littleme').fadeIn('slow');
I have a bunch of thumbnails which I am loading with a style of visibility: hidden;
so that they all maintain their correct layouts. Once the page is fully loaded I have a jquery function that fades them in. This worked when their style was set to display: none;
but obviously the layout screwed up then. Any suggestions?
Heres the fade line:
$('.littleme').fadeIn('slow');
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
像这样向链添加一些调用:
这将在淡入之前将其更改为
display:none
1 帧,再次占据该区域。Add a few calls to the chain like this:
This will change it to
display:none
for 1 frame before fading in, occupying the area again.尝试使用不透明度和 animate() :
try using opacity and
animate()
:我已隐藏
显示:
$('span').fadeTo(1000,1)
隐藏:
$('span').fadeTo(1000,0)
空间保留在 DOM 布局中
http://jsfiddle.net/VZwq6/
<span style="opacity:0;">I'm Hidden</span>
To Show :
$('span').fadeTo(1000,1)
To Hide :
$('span').fadeTo(1000,0)
The space is preserved in the DOM layout
http://jsfiddle.net/VZwq6/
你不能用 fadeTo(duration, value) 代替吗?当然,这样你就可以淡出到 0 和 1,这样你就不会影响文档流......
Cant you use fadeTo(duration, value) instead? Surely this way you can fade to 0 and 1, that way you are not affecting the document flow...
尝试匹配隐藏元素?
$(".littleme:隐藏").fadeIn();
Try matching for the hidden element?
$(".littleme:hidden").fadeIn();