Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery Clear Inline css

Tags:

jquery

css

inline

I have the below JQuery Code and I need to clear the inline css done by this animation

$(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');

});  
});

Here is the HTML code if needed:

<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>

Can you tell me how can I clear the Inline css please?

Thanks

like image 992
Mark Avatar asked Feb 14 '26 00:02

Mark


1 Answers

You can use the !important in your CSS:

.test{
    right:800px !important;    
}    

That code will make your inline css ignored.

Or you can get the attribute style of the DOM , using:

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

Or:

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

That's yours to use solution which you prefer more.

like image 150
anztrax Avatar answered Feb 15 '26 12:02

anztrax



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!