如何使用!重要在jQuery animate()函数 [英] how to use !important in jQuery animate() function

查看:88
本文介绍了如何使用!重要在jQuery animate()函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请参阅下面的jQuery:



我真的想知道如何使用CSS !important code> height 。

  $ j('#lveis-wrapper_3')。animate({
opacity:0.0,
height:200
},1200);

#lveis-wrapper_3 的CSS

 #lveis-wrapper_3 
{
width:844px!important;
height:936px!important;
margin:0pt 0pt 10px!important;
padding:0pt!important;
float:none;
}

我无法移除!important height:936px 因为某些原因...

所以我想改变 height 通过 animate() jQuery函数 - 但如何?

解决方案

您不能这样做。



href =http://api.jquery.com/animate/> jQuery文档 ...



所有动画属性应为动画为单个数字值 ... ...大多数非数字属性不能使用基本jQuery功能进行动画... p>

http://api.jquery.com/animate/ p>




我强烈建议您重新检查您是否需要!important / p>

Please see the jQuery below:

I am really wondering how can I use CSS !important for height in this code.

        $j('#lveis-wrapper_3').animate({
            opacity: 0.0,
            height : 200
        }, 1200);

The CSS of #lveis-wrapper_3 is below :

#lveis-wrapper_3
{
    width: 844px !important;
    height: 936px !important;
    margin: 0pt 0pt 10px !important;
    padding: 0pt !important;
    float: none;
}

I can not remove !important from height: 936px for some reasons...
so I want to change that height by animate() jQuery function - but how?

解决方案

You just cannot do this.

As per jQuery documentation...

"All animated properties should be animated to a single numeric value... ... most properties that are non-numeric cannot be animated using basic jQuery functionality..."

http://api.jquery.com/animate/


I strongly recommend re-examining your need for !important.

这篇关于如何使用!重要在jQuery animate()函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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