自定义效果不起作用

时间:2013-05-16 19:55:04

标签: jquery

我使用.animate()方法制作了自定义效果方法,以获得更好的slideUpslideDown方法。 Here's the result

动画moveUp有效但moveDown没有,我必须在fadeIn来电中通过.init()。我知道它是因为这个CSS,

.js-enabled form {
position: absolute;
top: -21px;
display: none;
}

fadeIn删除display: none;

所以,我将CSS更改为

/* top: -21px; */
/* display: none; */
top: -330px;  /* <-- Added later and everything stopped working */

Here's the result

为什么它不起作用的任何想法?

感谢您的帮助!

修改

发现问题,它在JS第34行

if (container.is(':hidden')) {

我把它改成了

if (container.css('top') == -330) {

但仍然没有

1 个答案:

答案 0 :(得分:0)

解决了它。

container.css('top')返回一个字符串(使用console.log(typeof container.css('top'));

确认

因此,将if条件更改为container.css('top') === '-330px')就可以了。

Fiddle