jQuery equivalent of YUI StyleSheet Utility?

北慕城南 提交于 2019-12-17 09:47:07

问题


Does jQuery - or one of it's plugins - have equivalent functionality to the YUI StyleSheet Utility?

"The StyleSheet Utility is capable of creating new stylesheets from scratch as well as modifying the existing stylesheets held as properties of elements sourced from the same domain or any inline elements."

This (I'm fairly sure) is creating and modifying CSS stylesheets themselves not looping through the DOM and changing element's style property (as the jQuery.css() method does).

I think this technique has the potential to significantly change the way a lot user interface related Javascript is written so would be interested to hear about any other libraries where it's been implemented too.


回答1:


Found a couple that look like they do similar things. I haven't tested them. jQuery.Rule looks to be pretty good though

jQuery.Rule by Ariel Flesler

This plugin allows quick creation/manipulation of CSS Rules, in a "jQuery-way". It includes features like chaining, iteration using each, selectors with context.

GlobalStylesheet by Jeremy Lea

Enables CSS modification that uses a 'global' stylesheet, rather than inline CSS. This is particularly handy for modifying CSS styles that you want to remain persistent until a page is refreshed again.




回答2:


The short answer is no. YUI is the avant garde in this matter.

However I fully expect there to be something similar being made in the coming weeks(months), as the methodology that YUI is using does not seem to be unreplicable and considering how useful and important this feature is.

Maybe study YUI's method and make a plugin yourself?

Edit: Looks like I'm wrong. This is why you never post negatives like this. :)



来源:https://stackoverflow.com/questions/1079237/jquery-equivalent-of-yui-stylesheet-utility

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!