jQuery Tools tab(幻灯片) |
||||||||||||||||||||||||||||||||||||||||||||||||||||
本文标签:tab,幻灯片 html 复制代码 代码如下: <!DOCTYPE html> <html> <head> <title>jQuery Tools standalone demo</title> <!-- include the Tools --> <script src="http://cdn.jquerytools.org/1.2.7/full/jquery.tools.min.js"></script> <link rel="stylesheet" type="text/css" href="./tabs-slideshow.css"/> </head> <body><!-- "previous slide" button --> <a class="backward">prev</a> <!-- container for the slides --> <div class="images"> <!-- first slide --> <div> <h3>First pane</h3> <p style="font-weight:bold"> Aenean nec imperdiet ligula. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. </p> <p> Suspendisse potenti. Sed elementum risus eleifend massa vestibulum consectetur. Duis massa augue, aliquam eget fringilla vel, aliquam vitae arcu. Nam sed magna mi. Praesent odio neque, dapibus sit amet suscipit at, tempus sed nibh. Aliquam sagittis ligula in ligula faucibus cursus. Quisque vulputate pellentesque facilisis. </p> </div> <!-- second slide --> <div> <h3>Second pane</h3> <p style="font-weight:bold"> Consectetur adipiscing elit. Praesent bibendum eros ac nulla. Integer vel lacus ac neque viverra. </p> <p> Vivamus euismod euismod sagittis. Etiam cursus neque non lectus mattis cursus et a libero. Vivamus condimentum hendrerit metus, a sollicitudin magna vulputate eu. Donec sed tincidunt lectus. Donec tellus lectus, fermentum sit amet porta non, rhoncus ac mi. Quisque placerat auctor justo, a egestas urna tincidunt eleifend. </p> </div> <!-- third slide --> <div> <h3>Third pane</h3> <p style="font-weight:bold"> Non lectus lacinia egestas. Nulla hendrerit, felis quis elementum viverra, purus felis egestas magna. </p> <p> Aenean elit lorem, pretium vitae dictum in, fermentum consequat dolor. Proin consectetur sollicitudin tellus, non elementum turpis pharetra non. Sed quis tellus quam. </p> </div> </div> <!-- "next slide" button --> <a class="forward">next</a> <!-- the tabs --> <div class="slidetabs"> <a href="#"></a> <a href="#"></a> <a href="#"></a> </div> <div style="clear:both;margin:30px 0 0;text-align:center;"> <button onClick=$(".slidetabs").data("slideshow").play();>Play</button> <button onClick=$(".slidetabs").data("slideshow").stop();>Stop</button> </div> <script language="JavaScript"> $(function() { $(".slidetabs").tabs(".images > div", { // enable "cross-fading" effect effect: fade, fadeOutSpeed: "slow", // start from the beginning after the last tab rotate: true // use the slideshow plugin. It accepts its own configuration }).slideshow(); }); </script> </body> </html> css 复制代码 代码如下: /* container for slides */ .images { background:#fff repeat-x; border:1px solid #ccc; position:relative; height:300px; width:560px; float:left; margin:15px; cursor:pointer; /* CSS3 tweaks for modern browsers */ -moz-border-radius:5px; -webkit-border-radius:5px; -moz-box-shadow:0 0 25px #666; -webkit-box-shadow:0 0 25px #666; } /* single slide */ .images div { display:none; position:absolute; top:0; left:0; margin:7px; padding:15px 30px 15px 15px; height:256px; font-size:12px; } /* header */ .images h3 { font-size:22px; font-weight:normal; margin:0 0 20px 0; color:#456; } /* tabs (those little circles below slides) */ .slidetabs { clear:both; margin-left:310px; } /* single tab */ .slidetabs a { width:8px; height:8px; float:left; margin:3px; background:url(./navigator.png) 0 0 no-repeat; display:block; font-size:1px; } /* mouseover state */ .slidetabs a:hover { background-position:0 -8px; } /* active state (current page state) */ .slidetabs a.current { background-position:0 -16px; } /* prev and next buttons */ .forward, .backward { float:left; margin-top:140px; background:#fff url(./hori_large.png) no-repeat; display:block; width:30px; height:30px; cursor:pointer; font-size:1px; text-indent:-9999em; } /* next */ .forward { background-position: 0 -30px; clear:right; } .forward:hover { background-position:-30px -30px; } .forward:active { background-position:-60px -30px; } /* prev */ .backward:hover { background-position:-30px 0; } .backward:active { background-position:-60px 0; } /* disabled navigational button. is not needed when tabs are configured with rotate: true */ .disabled { visibility:hidden !important; } PS:用到些图片 复制代码 代码如下: $(function() { $(".slidetabs").tabs(".images > div", { // enable "cross-fading" effect effect: fade, fadeOutSpeed: "slow", next:.forward, prev:.backward, // start from the beginning after the last tab rotate: true // use the slideshow plugin. It accepts its own configuration }).slideshow(); }); 这个同html中的js •配置 配置选项的完整列表的幻灯片插件 。
JavaScript API
事件确保你已经阅读 大约 事件 jQuery工具 。 所有事件监听器接收 这个 事件 对象 作为第一个参数 。
|