开发者

several jquery ui theme switcher problems (cookie, different themes for different pages, etc.)

I just try putting the jquery-ui theme switcher on my website. Seems that there are some problems:

  • Cookie does not work. When I close the browser and reopen the webpage, the default theme will load instead of the one selected before.
  • The selected theme is valid for current page only. If jumping to another page, it will load the default. I want to select开发者_C百科 once and apply to all pages.
  • There is a flash of the default theme before the selected theme get loaded.

Anyone know an easy way deal with these problems? I know I can implement my own cookie solution based on that theme switcher, but I was so surprised that the author did not provide options to do these.


I end up downloading the script and modified it a bit, adding an option named cookieOptions which will be passed to the $.fn.cookie plug-in. Set cookieOptions = {path: '/'}, so that the theme will apply to the whole website globally. For the short flash of the default theme, the solution is to update css link on the client side instead of making a request to a php file on the server.


I bet if your using IE!

Open it with Firefox and I bet it will work.

I am looking for a solution to this now.

InsiteFX


To fix the issue, all you have to do is initialize themeswitcher like so:

$("#switcher").themeswitcher({expires: 365, path:'/sample/'});

expires - is the number of days to live
path - pretty self explanatory

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜