Is it even possible to change the pseudo classes with jQuery ? Is there any workaround for achieving this?
-
it is not possible to use jQuery for such casesSushanth --– Sushanth --2013-05-13 23:53:33 +00:00Commented May 13, 2013 at 23:53
-
A few days ago I found a jQuery-style library to access stylesheets, but now I can't find it again, all I find are stylesheet switchers.Barmar– Barmar2013-05-13 23:56:41 +00:00Commented May 13, 2013 at 23:56
-
Not sure I understand. Could you elaborate? What exactly do you want to change?VVV– VVV2013-05-13 23:56:54 +00:00Commented May 13, 2013 at 23:56
Add a comment
|
2 Answers
Try to create a class selector to your CSS, and toggle the class on and off for the element you would like to change style/anything when you hover over it.
Here are other suggestions: Setting CSS pseudo-class rules from JavaScript
Well I created the following function to change my hover class
var setPseudoClass = function (rule, prop, value)
{
var sheets = document.styleSheets;
var slen = sheets.length;
for (var i = 0; i < slen; i++)
{
var rules = document.styleSheets[i].cssRules;
if (rules)
{
var rlen = rules.length;
for (var j = 0; j < rlen; j++)
{
if (rules[j].selectorText && rules[j].selectorText.indexOf(rule) > 0)
{
alert(rules[j].selectorText);
rules[j].style[prop] = value;
}
}
}
}
}