The problem is that the date picker theme is also applied to my tabs CSS. For example the "ui-widget" css properties is applied to both date picker and tabs elements.
I can't seem to find a way to apply the css properties to only the date picker. I can't see a "super selector" that only applies to the date picker DIV.
As such, I cannot add a super selector. What would be great would be that the date picker widget supports CSS scope. But it does not. I'm stuck manually editing the jQuery CSS file.
The .addClass() jQuery function will add the necessary class to the datepicker for it to be picked up by the themed stylesheet.
.addClass()jQuery函数将为datepicker添加必要的类,以便由主题样式表拾取。
I had to attach to the window's load event rather than the document's ready event because the datepicker had not been inserted by then.
我不得不附加到窗口的加载事件而不是文档的ready事件,因为那时还没有插入datepicker。
Note: There will be a small delay between the time the datepicker is added to the DOM and the new class applied, which means the datepicker may appear unstyled while the page is finishing loading.
You can customize your theme with the theme roller here http://jqueryui.com/themeroller/
您可以使用主题滚轮自定义主题http://jqueryui.com/themeroller/
Find the item you want to style with Firebug's inspect DOM feature to target the class you want to select.
使用Firebug的inspect DOM功能找到要设置样式的项目,以定位要选择的类。
#3
1
I had the same problem with the datepicker and the accordion. I wanted the new styling of the datepicker but didn't want it for the accordion. I took the easy way out, I copied the relevant parts of ui.theme.css and added .ui-datepicker in front of all the styles. This targets just the datepicker and leaves all other UI plugins alone.