开发者

How do I switch between jQuery styles dynamically?

Right, so I've got a JavaScript style switcher implemented for a site (i.e. buttons at the top that allow user to change css of each individual page). Thing is, we've got a jQuery-ui datepicker on each page, and I can't figur开发者_如何学Pythone out how to get it to change it's style on the button click too. I've got the .css files for it (jquery-ui-1.8.11.custom.css for default and jquery-ui-1.8.11.customLow.css for the secondary style), and was hoping I could just write a function for it directly in the jQuery ui JS file (jquery-ui-1.8.11.custom.min.js) So, long story short, can anyone explain exactly how the jQuery ui JS file finds and sets its stylesheet?


The jQuery ui JS file doesn't "find" a style-sheet. It is just styled from your stylesheets, like any other collection of DOM elements. You probably just don't have any of its unique "ui namespaced" selectors in the other CSS files you are switching.


jQuery UI doesn't load it's styles through JavaScript. It uses whatever styles you've set up through your <style> tags.

What you're looking for here is to modify your "JavaScript style switcher" so that it also switches between the different jQuery UI stylesheets that you want.

If you post the code for the "JavaScript style switcher", I can help you with what needs to change, though it should be pretty straightforward.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜