如果我想要一个页面有一个主题滚轮(或多或少像 jQuery themeroller),它应该如何工作
基本思想是创建一个页面,使用户能够从菜单中选择皮肤或主题。当用户选择所需的皮肤/主题时,它应该应用到页面,就像jquery ui主题滚轮页面一样。
所以,更准确地说,我想知道的是如何将样式动态应用到页面 - 如何加载 css 等等。在jquery ui主题滚轮上,加载新的样式集后是否会触发任何javascript? (对于 js 定位或调整大小?)
(答案可能很简单,“只需创建一个新的样式元素并设置其 src”...)
需要明确的是,我不需要让用户自定义 UI 的选项,我希望他们能够从一些预设的样式中进行选择。
谢谢!
The basic idea is to create a page that gives the user the ability to choose a skin or theme from a menu. When the user selects the desired skin/theme, it should be applied to the page, just like the jquery ui theme roller page.
So, to be more precise, what I am trying to know is how to apply dynamically the style to a page - how to load the css and so forth. On the jquery ui theme roller, is there any javascript triggered after the new set of styles is loaded? (for js positioning or sizing?)
(The answer may be simple as "just create a new style element and set its src"...)
Just to be clear, I don't need the option to let users customize the UI, I want them just to be able to pick from a few pre set styles.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您必须为每个样式创建多种样式,然后使用其中一些:
jQuery Styleswitcher Widget
更新:
链接似乎不起作用,这很奇怪官方网站上怎么会有这样的东西,但是,您可能会发现这很有用:
10 个实用的 jQuery 样式切换器
You will have to create multiple styles for each them and then use some:
jQuery Styleswitcher Widget
Update:
It seems that links are not working which is strange how such stuff is there on official site, however, you may find this useful:
10 Practical jQuery Style Switchers
为什么不使用 主题切换小部件 甚至提供 书签(适用于 Firefox)?
Why not use the Theme Switcher Widget or even provide the bookmarklet (for Firefox)?
为什么不直接使用themeroller呢?尝试将 themeswitcher 添加到相关页面并尝试。
Why not just use themeroller anyway? Try adding themeswitcher to the page in question and try.