jQuery中的简单fadeIn和visibility [英] Simple fadeIn and visibility in jQuery

查看:127
本文介绍了jQuery中的简单fadeIn和visibility的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将一个div的css属性 visibility 更改为 visible 和一个jQuery .fadeIn()转换。

I'm trying to change the css property visibility of a div to visiblewith a jQuery .fadeIn()transition.

这是我的代码:

$('a').click(function() {
    $('#test').fadeIn('slow', function() {
     $(this).css('visibility','visible');
  });
});​

和小提琴: http://jsfiddle.net/np6r7/

推荐答案

您不能对 visibility 进行动画处理。 fadein 关键是 display:none; ,因此应该 #test 的初始状态通过CSS。如果您需要保留布局,可以尝试在指定所需高度和/或宽度的div中包装测试。

You cannot animate visibility. fadein is keyed off display:none;, so that should be #test's initial state via CSS. If you need to keep the layout, you can try wrapping test in a div that specifies the height and/or width you need.

这篇关于jQuery中的简单fadeIn和visibility的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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