Ishey4
Ishey4

Reputation: 327

using jquery to dynamically change webkit

i am trying how to use jquery to dynamically change -webkit.

my css

::-webkit-scrollbar-button {
    height: 75px;
    width: 0;
    -webkit-box-shadow: inset 1px 1px 2px rgba(0,0,0,0.2);
}

my jquery

        $('::-webkit-scrollbar-button').css("height",'100px');

Upvotes: 2

Views: 372

Answers (1)

Adam Merrifield
Adam Merrifield

Reputation: 10407

I would just dynamically add a script element.

$('body').append('<style>::-webkit-scrollbar-button{height:75px;}</style>');

If you have to change this frequently you can remove the last one before you add the next one, but it wouldn't exactly be necessary because the last one would take precedence.

var $style = $('<style id="dynamicStyle">::-webkit-scrollbar-button{height:75px;}</style>');
$('#dynamicStyle').remove();
$('body').append($style);

Upvotes: 1

Related Questions