我有下面的 JQuery代码,我需要清除这个动画完成的内联css $(document).ready(function(){$("#panel").hide(); //updated line, removing the #panel ID. $('#tab2').toggle(function(){ //adding a toggle function to the #tab $("#pan
$(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}, 800, 'swing', function() {
$('.contentSideBar').fadeIn('slow');
});
},
function(){ //when the #tab is next cliked
$('#ToolsTitleSpan').text("OPEN TOOLS");
$('#tab2').stop().animate({right: '-=225'}, 800, 'swing', function() {
$('.contentSideBar').fadeOut(slow, function() {});
});
$('#panel').stop().animate({width:"0", position:'absolute', float: 'right', opacity:0.1}, 800, '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 : ""});
那是您使用您更喜欢的解决方案.
