jQuery淡入淡出元素不显示样式为“可见性:隐藏"的元素 [英] jquery fade element does not show elements styled 'visibility: hidden'

查看:158
本文介绍了jQuery淡入淡出元素不显示样式为“可见性:隐藏"的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆缩略图,它们以visibility: hidden;样式加载,以便它们都保持正确的布局.页面完全加载后,我有一个jquery函数可以使它们淡入.当其样式设置为display: none;时,此功能有效,但显然布局随后被弄乱了.有什么建议吗?

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?

在此处显示渐变线:

$('.littleme').fadeIn('slow');

推荐答案

向链中添加一些调用,如下所示:

Add a few calls to the chain like this:

 $('.littleme').css('visibility','visible').hide().fadeIn('slow');

这将在淡入之前将其更改为display:none一帧,再次占据该区域.

This will change it to display:none for 1 frame before fading in, occupying the area again.

这篇关于jQuery淡入淡出元素不显示样式为“可见性:隐藏"的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆