這篇文章講解下載了jQuery UI后jquery ui如何使用,我們以jquery ui-1.8.16為例說(shuō)明下載了jquery ui如何使用,, jquery ui 下載地址: http://www./archives/jquery-ui-download.html下載到j(luò)query-ui-1.8.16.custom.zip是一個(gè)壓縮包,,我們將其解壓到一個(gè)目錄jquery-ui,打開(kāi)目錄后里面有一個(gè)叫index.html的,,我們直接用瀏覽器打開(kāi)可以看到里面已經(jīng)放了很多的,,jquery ui組件的實(shí)例,其中有可折疊的面板控件jquery Accordion,,jquery ui tabs,,jquery ui dialog,jquery overlay,,jquery ui Framework Icons,,jquery ui slider,jquery datepicker,,jquery ui progressbar,,jquery highlight。 進(jìn)入development-bundle/demos/這里面放置了所有,,jquery ui組件的實(shí)例,,我們選擇其中一個(gè)經(jīng)常用到的組件jquery ui tabs講解jquery ui的使用方法: 進(jìn)入development-bundle/demos/tabs目錄,用編輯器打開(kāi)default.html插件,代碼如下 01. <!DOCTYPE html> 02. <html lang= "en" > 03. <head> 04. <meta charset= "utf-8" > 05. <title>jQuery UI Tabs - Default functionality</title> 06. <link rel= "stylesheet" href= "../../themes/base/jquery.ui.all.css" > 07. <script src= "../../jquery-1.6.2.js" ></script> 08. <script src= "../../ui/jquery.ui.core.js" ></script> 09. <script src= "../../ui/jquery.ui.widget.js" ></script> 10. <script src= "../../ui/jquery.ui.tabs.js" ></script> 11. <link rel= "stylesheet" href= "../demos.css" > 12. <script> 13. $( function () { 14. $( "#tabs" ).tabs(); 15. }); 16. </script> 17. </head> 18. <body> 19. <div class= "demo" > 20. <div id= "tabs" > 21. <ul> 22. <li><a href= "#tabs-1" >Nunc tincidunt</a></li> 23. <li><a href= "#tabs-2" >Proin dolor</a></li> 24. <li><a href= "#tabs-3" >Aenean lacinia</a></li> 25. </ul> 26. <div id= "tabs-1" > 27. <p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p> 28. </div> 29. <div id= "tabs-2" > 30. <p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p> 31. </div> 32. <div id= "tabs-3" > 33. <p>Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.</p> 34. <p>Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.</p> 35. </div> 36. </div> 37. </div><!-- End demo --> 38. <div class= "demo-description" > 39. <p>Click tabs to swap between content that is broken into logical sections.</p> 40. </div><!-- End demo-description --> 41. </body> 42. </html> 在head中載入了兩個(gè)css文件,,jquery.ui.all.css和demo.css 四個(gè)js文件,,jquery-1.6.2.js(jquery類庫(kù)),jquery.ui.core.js(jquery ui核心文件),,使用所有的jquery ui組件都要先載入這兩個(gè)類庫(kù),,接下來(lái)是jquery.ui.widget.js,jquery.ui.tabs.js,。最后 1. <script> 2. $( function () { 3. $( "#tabs" ).tabs(); 4. }); 5. </script> 01. < div id = "tabs" > 02. < ul > 03. < li >< a href = "#tabs-1" >tab1</ a ></ li > 04. < li >< a href = "#tabs-2" >tab2</ a ></ li > 05. < li >< a href = "#tabs-3" >tab3</ a ></ li > 06. </ ul > 07. < div id = "tabs-1" > 08. < p >tab1內(nèi)容</ p > 09. </ div > 10. < div id = "tabs-2" > 11. < p >tab2內(nèi)容</ p > 12. </ div > 13. < div id = "tabs-3" > 14. < p >tab3內(nèi)容</ p > 15. </ div > 16. </ div >
|
|