开发者

Adding an attribute to a css class with MooTools

I'd like to add an attribute to a CSS class using MooTools. I know that I can use removeClass and addClass to add and remove classes from different elements, but I'm looking to modify the global behavior of the entire class itself.

The only thing I can 开发者_高级运维think of is doing $$('.classname').each and using set('style','whatever'). Is there a better way?


yes - there is a better way, you can redefine the CSS style itself, else you'd have to continuously apply changes every time you create a new element of that class and that's not very performant and practical.

check this answer: Changing style of :hover selector in mootools and the jsfiddle i made for it: http://jsfiddle.net/dimitar/Z9RPP/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜