【轉】jquery scrollable的使用

這個是簡單的例子 http://flowplayer.org/tools/demos/scrollable/one-sized.html

參數配置URL:http://flowplayer.org/tools/scrollable/index.html  ,有中文翻譯(http://www.jb51.net/article/19903.htm)

 

完整的HTML代碼如下:

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://flowplayer.org/tools/css/tabs-flowplayer-v2.css" />
<style>
/* override the root element to enable scrolling */
#flowpanes {
 position:relative;
 overflow:hidden;
 clear:both;
}

/* override single pane */
#flowpanes div {
 float:left;
 display:block;
 width:670px;
 font-size:14px;
}

/* our additional wrapper element for the items */
#flowpanes .items {
 width:20000em;
 position:absolute;
 clear:both;
 margin:0;
 padding:0;
}

#flowpanes .less, #flowpanes .less a {
 color:#999 !important;
 font-size:11px;
}
</style>

<script src="</script'>http://cdn.jquerytools.org/1.2.5/full/jquery.tools.min.js?foo"></script>
<script type="text/javascript" >
$(function() {

 // select #flowplanes and make it scrollable. use circular and navigator plugins
 $("#flowpanes").scrollable({ circular: true, mousewheel: true }).navigator({

  // select #flowtabs to be used as navigator
  navi: "#flowtabs",

  // select A tags inside the navigator to work as items (not direct children)
  naviItem: 'a',

  // assign "current" class name for the active A tag inside navigator
  activeClass: 'current',

  // make browser's back button work
  history: true

 });
});

</script>
</head>
<body  >
<!-- tabs work as navigator for scrollable -->
<ul id="flowtabs" class="navi">
 <li><a id="t1" href="#story">The Story</a></li>
 <li><a id="t2" href="#features">Features</a></li>
 <li><a id="t3" href="#plugins">Plugins</a></li>
 <li><a id="t4" href="#demos">Demos</a></li>
</ul>

<!-- tab panes -->
<div id="flowpanes">

 <!-- wrapper for scrollable items -->
 <div class="items">

  <!-- the items -->
  <div> xxxxxxxxxxxxxxxxxDIV[ any HTML here ]</div>
  <div> [ any HTML here ]</div>
  <div> [ any HTML here ]</div>
  <div> [ any HTML here ]</div>

 </div>

</div>

<!-- "Previous" action -->
<button class="prev">&laquo; Previous</button>

<!-- "Next" action -->
<button class="next">Next &raquo;</button>


</body>
</html>

分析:

$("div.scrollable").scrollable({ 
size: 3, 
vertical:false, 
//clickable:false, 
loop:true,//設置是否自動跳轉(根據間隔時間) 
//interval: 1000,//設置間歇時間間隔 
//speed:2000, 
items: '#thumbs', 
//prev:'.prev',//跳轉到上一項 
//next:'.next'//跳轉到下一項 
prevPage:'.prev',//跳轉到上一頁 
nextPage:'.next',//跳轉到下一頁 
hoverClass: 'hover', 
easing:'linear' 
}); 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章