I don't think there is a jQuery way, but in native JavaScript you can directly manipulate the rules on the stylesheet objects:
document.styleSheets[2].addRule("::-webkit-scrollbar", "width: 300px;");
It works great. You can also remove the rules and change the rules: http://www.javascriptkit.com/domref/stylesheet.shtml
You can provide a <style> a title block that will simplify the search in the styleSheets array. Something like:
for(var i = 0; i < document.styleSheets.length; i++) { var sheet = document.styleSheets[i]; if(sheet.title == 'scrollbar') { for(var j = 0; j < sheet.rules.length; j++) { var rule = sheet.rules[j]; if(rule.cssText.match("webkit-scrollbar")) { rule.style.backgroundColor="yellow"; } } } }
http://jsfiddle.net/nottrobin/hSEzY/1/
Robin winslow
source share