jQuery   发布时间:2022-04-19  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Jquery Clear Inline css大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我有下面的 JQuery代码,我需要清除这个动画完成的内联css

$(document).ready(function(){

$("#panel").hide(); //updated line,removing the #panel ID.

 $('#tab2').toggle(function(){ //adding a toggle function to the #tab
    $("#panel").show();

        $('#ToolstitleSpan').text("CLOSE TOOLS");

        $('#tab2').stop().animate({right: '225'},800,'swing',function() {});

        $("#panel").stop().animate({right: '72',width: '230px',opacity:0.8},function() {

                $('.contentSideBar').fadeIn('slow');        
  });


},function(){ //when the #tab is next cliked
 $('#ToolstitleSpan').text("OPEN TOOLS");

 $('#tab2').stop().animate({right: '-=225'},function() {

            $('.contentSideBar').fadeOut(slow,function() {});
 });

 $('#panel').stop().animate({width:"0",position:'absolute',float: 'right',opacity:0.1},'swing');

});  
});

如果需要,这是HTML代码

<div id="panelKS"> <!--the hidden panel -->
    <div class="contentSideBarKS">
    </div>
</div>

<div id="tab2KS">
    <span id="ToolstitleSpanOpenKS">
        <img id="bg" src="<?PHP echo $OUTPUT->pix_url('/buttons/opentools','theme')?>"/>
    </span>
    <span id="ToolstitleSpanCloseKS">
        <img id="bg" src="<?PHP echo $OUTPUT->pix_url('/buttons/closetools','theme')?>"/>
    </span>
</div>

你能告诉我怎样才能清除内联css吗?

谢谢

解决方法

您可以在CSS中使用!important:

.test{
    right:800px !important;    
}

代码将使您的内联css被忽略.

或者您可以使用以下命令获取DOM的属性样式:

$("div.test").attr("style","");

要么:

$("div.test").attr({style : ""});

那是您使用您更喜欢的解决方案.

大佬总结

以上是大佬教程为你收集整理的Jquery Clear Inline css全部内容,希望文章能够帮你解决Jquery Clear Inline css所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。