1

I know this is very silly question but I am stuck . I have been trying to add the position:absolute !important using JQUERY function .CSS() but I found out that it is not happening .

my script is something like this .

$(document).ready(function(){
    var winSize = $('#outerPage').height();
    alert(winSize);
     setTimeout(function () {
    //$('#at4m-mobile-container').addClass('bottom');
    $('body div.at4m-dock').css("top",winSize);
    $('body div.at4m-dock').css({"position":"absolute","font-size":"200% !important"});
    $('body div.at4m-dock-toggle').css("top",winSize);
    }, 7500);  

});

Please give me some suggestion

Thanks and regards

1

3 Answers 3

3

jQuery is not understanding the !important attribute.

You can use attr()

Try:

 $('body div.at4m-dock').attr('style', 'font-size: 200% !important;position:absolute !important;');

DEMO

Sign up to request clarification or add additional context in comments.

1 Comment

I am accepting your answer because :)
1

Use as, as per my understanding you can not use as "font-size":"200% !important" in %

  $('body div.at4m-dock').css({"position":"absolute!important","font-size":"22px !important"});

3 Comments

@DownVoter please provide reason
I am not the DownVoter but this will not work. jQuery can not understand !important as a rule. Check it here: jsfiddle.net/7j5Jc/1
Yes I looked into the fiddle it does not understand !important . and regarding the down vote no rpoblem i upvoted your answer :)
1

!important is not supported by jQuery.

Also .css() function add inline style so you don't need !important. So you should simply remove it.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.