日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

jquery ui动态切换主题的一种实现方式

發布時間:2023/12/13 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 jquery ui动态切换主题的一种实现方式 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
這兩天看coreservlets上的jQuery教程,雖然比較老了,不過講得還是不錯。最后一部分講jQuery ui 主題切換,用他介紹的方法實現不了。于是自己修改了下,可以了。
代碼如下:html部分:<fieldset?class="ui-widget"><legend>Changing?Themes?(Skins)?at?Run?Time</legend><div?class="ui-widget-content?ui-corner-all"?????id="themes-div">??<input?type="radio"?name="themes"?value="black-tie"/>Black?Tie??<input?type="radio"?name="themes"?value="blitzer"/>Blitzer??<input?type="radio"?name="themes"?value="le-frog"/>Le?Frog??<input?type="radio"?name="themes"?value="smoothness"/>Black?Tie<br/>??<input?type="radio"?name="themes"?value="start"/>Start??<input?type="radio"?name="themes"?value="trontastic"/>Trontastic??<input?type="radio"?name="themes"?value="ui-darkness"/>UI-Darkness??<input?type="radio"?name="themes"?value="my-theme"/>My?Theme(downloaded)??<input?type="radio"?name="themes"?value="jquery-ui"/>UI?Lightness?(Default)</div></fieldset>?
js部分:var?uiDemo?=?{};?//?To?avoid?name?conflicts??
uiDemo.switchToTheme?=?function(themeName)?{?? ??var?$link?=?$("link[href$='jquery-ui.css']"); //獲取link節點? ? $link.attr("href","./css/"+themeName+"/jquery-ui.css"); //改變link節點的href屬性};uiDemo.switchToSelectedTheme?=?function()?{??var?theme?=?$(this).val();??uiDemo.switchToTheme(theme);};
$(function()?{?
? ??$("#themes-div?input").click(uiDemo.switchToSelectedTheme);
});?

附他的實現方式:uiDemo.switchToTheme?=?function(themeName)?{
?var?attributes?=?{?
????type:?"text/css",????rel:?"stylesheet",????href:?"css/"?+?themeName?+?"/jquery-ui.css"??};??var?styleSheetLink?=?$("<link>",?attributes);??$("head").append(styleSheetLink);};

其他部分相同。



來自為知筆記(Wiz)

轉載于:https://www.cnblogs.com/homer3000/p/4637835.html

總結

以上是生活随笔為你收集整理的jquery ui动态切换主题的一种实现方式的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。