您的位置:首页 > Web前端 > JQuery

jQuery Tools tab(幻灯片)

2012-07-14 00:00 375 查看
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:用到些图片


实例js
$(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
•配置
配置选项的完整列表的幻灯片插件。
属性
默认值
描述
next
'.forward'
选择器进行的元素的“下一个选项卡”行动应该 绑定。 如果您实例化多个幻灯片在相同的页面上 你需要附上所有幻灯片元素(标签/窗格/下 &上一页动作)在一个共同的包装器元素。 这种逻辑 遵循 相同的原则 作为创建 多个选项卡的实例。prev

prev

'.backward'
选择器的兄弟元素“之前的选项卡” 动作应该绑定。 如果您实例化多个幻灯片 与相同的电话,你需要附上所有幻灯片元素 (标签/窗格/下&上一页动作)在一个共同的包装器 元素。 这种逻辑遵循 相同 原则 作为创建多个选项卡的实例。

disabledClass
'disabled'
CSS类名'disabled'上一页 和 接下来 元素。 例如, 这个 上一页 元素是当没有'disabled'的 前面提及的卷轴。

autoplay
false
如果这个属性设置为 真正的 然后选项卡将 自动前进到下一个选项卡实现 自动“玩”的幻灯片。 这是方便 使 旋转 属性选项卡。

autopause
true
如果这个属性设置为 真正的 ,当未来/上一页 选项卡操作按钮是mouseovered然后autoplay 功能将会暂停。

interval
3000
时间(以毫秒为单位)自动走到之间 选项卡。 只有当这个选项是有效的 自动播放 是 启用或 autoplay 方法被调用。

clickable
true
当设置为 真正的 然后选项卡将自动 推进到下一个选项卡通过单击可见的窗格。
JavaScript API
方法
返回值
描述/例子
getconf
Object
自从1.2.0 。 返回配置对象 对于这个插件

getTabs
Tabs
自从1.2.0 。 返回一个引用 这个 标签API 。

play
API
开始播放幻灯片。

pause
API
暂停幻灯片。 回放将恢复鼠标脱离了标签,窗格和导航按钮。

stop
API
停止幻灯片。 这只能通过调用恢复 这个 play 方法。
事件

确保你已经阅读 大约 事件 jQuery工具 。 所有事件监听器接收 这个 事件 对象 作为第一个参数。
事件
触发时间
onBeforePlay
开始之前播放。 返回 false 在 回调防止回放开始。

onPlay
当回放开始。

onBeforePause
在播放暂停。 返回 false 在 回调防止回放开始。

onPause
当播放暂停。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: