一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

jquery tools 系列 scrollable(2)

scrollable提供的一系列獲取scrollable對象的方法具體使用方式如下:
復制代碼 代碼如下:
var scrollable=$("div.scrollable").scrollable();
    //alert(scrollable.getConf().prev);//獲取配置對象中的prev屬性
    scrollable.getConf().speed=200;//設置配置對象的speed屬性
    //alert(scrollable.getIndex());//獲取當前滾動項的索引
    //alert(scrollable.getItems().length);//獲取當前滾動項的數(shù)量
    //alert(scrollable.getItemWrap().html());//獲取包含滾動項的節(jié)點(class=scrollable),并將所有滾動項顯示出來
    //alert(scrollable.getPageAmount());//獲取當前滾動欄分頁數(shù)
    //alert(scrollable.getPageIndex());//獲取當前所在分頁
    //alert(scrollable.getRoot().html());//獲取滾動項的上一級節(jié)點(id=thumbs)
    //alert(scrollable.getSize());
    //alert(scrollable.getVisibleItems().length);//獲取當前可見滾動項數(shù)量
    scrollable.next();//如果有下一個滾動項,則跳轉(zhuǎn)到下一個滾動項
    scrollable.prev(3000,function(){return true});//跳轉(zhuǎn)到前一滾動項
    //var seekTo= scrollable.click(0).seekTo(2,1000,function(){
        //alert(this.getIndex());
    //});

    //scrollable.move(2);
    //scrollable.prevPage();//跳轉(zhuǎn)到前一頁
    //scrollable.nextPage();//跳轉(zhuǎn)到
    //scrollable.setPage(1);//跳轉(zhuǎn)到
    //scrollable.begin();//跳轉(zhuǎn)到第一個滾動項
    //scrollable.end();//跳轉(zhuǎn)到最后一個滾動項
    scrollable.click(3);//使第四個滾動項處于選中狀態(tài)

    scrollable.onBeforeSeek(function(){
            alert("you click the "+this.getIndex()+"st scrollable item!");
    });

    $("#remove").click(function(){
        scrollable.getItems().filter(":last").remove();//刪除最后一個滾動項
        scrollable.reload().prev();//自動更新相關配置信息,并跳轉(zhuǎn)到被刪除滾動項的前一項
    });

以下是scrollable對象的方法說明描述:
方法名稱返回值說明
getConf()Object返回scrollable的配置對象,并且可通過設置該對象的相關屬性值來修改該配置對象的屬性。
getIndex()number獲取當前滾動項的索引號,0代表第一個元素,1代表第二個元素,以此類推。此外,需注意的是,如果獲取到多個滾動項,那么將會只返回第一個滾動項的索引號。
getItems()jQuery返回所有的滾動項,結(jié)果以jquery對象的方式返回。
getItemWrap()jQuery獲取滾動項的父節(jié)點,結(jié)果以jquery對象的方式返回。
getPageAmount()number獲取當前滾動欄的分頁數(shù)。
getPageIndex()number返回當前分頁索引號。比如說,如果分頁設置為5個滾動項/頁,并且當前滾動項位置為7的話,那么將會返回1(第二頁)
getRoot()jQuery獲取滾動項的上一級節(jié)點。
getSize()number返回滾動項的數(shù)量。該方法等同于getConf().size
getVisibleItems()jQuery獲取一個由當前可見滾動項組成列表,該列表為一個jquery對象,可見滾動項的數(shù)量由配置對象的size屬性定義。
   
reload()APIscrollable支持動態(tài)添加和刪除滾動項的功能。在動態(tài)添加或刪除滾動項以后,調(diào)用此方法來自動更新分頁導航以及滾動項移動的相關信息。
prev()API跳轉(zhuǎn)到該滾動項的前一項(如果該滾動項不是第一個滾動項)
next()API跳轉(zhuǎn)到該滾動項的下一項(如果該滾動項不是最后一個滾動項)
seekTo(index)API跳轉(zhuǎn)到指定索引處的滾動項。
move(offset)API將處于當前狀態(tài)(激活)的滾動項位置由當前滾動項向前/后移動offset。Offset為正,則滾動項向右/下移動,否則,向左/上移動。比如:move(2),則處于當前狀態(tài)的滾動項的索引由i滾動項轉(zhuǎn)移至i+2滾動項。
prevPage()API跳轉(zhuǎn)到前一頁(如果該頁不是第一頁)。
nextPage()API跳轉(zhuǎn)到后一頁(如果該頁不是最后一頁)。
setPage(index)API跳轉(zhuǎn)到第index頁。比如,index=2,那么會從當前頁跳轉(zhuǎn)到第3頁。
movePage(offset)API用于將顯示頁的位置由當前頁切換到該頁/后offset頁,該方法其他解釋類似于(offset)。
begin()API跳轉(zhuǎn)到第一個滾動項,相當于seekTo(0)。
end()API跳轉(zhuǎn)到最后一個滾動項。
click(index)API使第index個滾動項處于選中(激活)狀態(tài)。
   
onBeforeSeek(fn)API參見配置對象的onBeforeSeek相關說明
onSeek(fn)API參見配置對象的onSeek相關說明
注意:上面方法表中prev()方法以下的方法除了表中攜帶的參數(shù)外,還包含兩個隱含參數(shù):speed和callback。其中speed參數(shù)是用于控制滾動項的動畫效果持續(xù)時間的,而callback為其回調(diào)方法。具體實現(xiàn)可參見scrollable的prev()方法使用示例。

最后,給出本scrollable系列的完整示例代碼:
復制代碼 代碼如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script src="http://cdn.jquerytools.org/1.0.2/jquery.tools.min.js"></script>
<script src="http://static.flowplayer.org/js/jquery.mousewheel.js" ></script>
<link rel="stylesheet" type="text/css" />

<style><!--
div.scrollable {
    position:relative;
    overflow:hidden;
    width: 646px;    
    height:300px;    
}

#thumbs {    
    position:absolute;
    width:20000em;    
    clear:both;
    border:1px solid #222;
}

a.prev, a.next {
    margin-top:118px;    
}

#thumbs div {
    float:left;
    width:214px;
    height:300px;
    background:#333 url(/upload/20090906120115441.png) repeat-x 0 146px;
    color:#fff;
    border-left:1px solid #333;
    cursor:pointer;
}

#thumbs div.hover {
    background-color:#444;    
}

#thumbs div.active {
    background-color:#066;
    cursor:default;
}

#thumbs h3, #thumbs p, #thumbs span {
    margin:13px;        
    font-family:"bitstream vera sans";
    font-size:13px;
    color:#fff;    
}

#thumbs h3 em {
    font-style:normal;
    color:yellow;
}
--></style><style>div.scrollable {
    position:relative;
    overflow:hidden;
    width: 646px;    
    height:300px;    
}

#thumbs {    
    position:absolute;
    width:20000em;    
    clear:both;
    border:1px solid #222;
}

a.prev, a.next {
    margin-top:118px;    
}

#thumbs div {
    float:left;
    width:214px;
    height:300px;
    background:#333 url(/upload/20090906120115441.png) repeat-x 0 146px;
    color:#fff;
    border-left:1px solid #333;
    cursor:pointer;
}

#thumbs div.hover {
    background-color:#444;    
}

#thumbs div.active {
    background-color:#066;
    cursor:default;
}

#thumbs h3, #thumbs p, #thumbs span {
    margin:13px;        
    font-family:"bitstream vera sans";
    font-size:13px;
    color:#fff;    
}

#thumbs h3 em {
    font-style:normal;
    color:yellow;
}</style>




<!-- navigator -->
<div class="navi"></div>

<!-- prev link -->
<a class="prev"></a>

<!-- root element for scrollable -->
<div class="scrollable">

    <div id="thumbs">

        
            <div>

                <img src="http://files.jb51.NET/upload/20090906120116994.jpg" />

                <h3><em>1. </em>An example title</h3>

                <p>
                    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin et felis eget
                    tellus pharetra porttitor. Praesent dui arcu, egestas quis, adipiscing a.
                </p>

                <span class="blue">60 sec</span>

            </div>

            <div>

                <img src="http://files.jb51.NET/upload/20090906120117587.jpg" />

                <h3><em>2. </em>An example title</h3>

                <p>
                    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin et felis eget
                    tellus pharetra porttitor. Praesent dui arcu, egestas quis, adipiscing a.
                </p>

                <span class="blue">80 sec</span>

            </div>

            <div>

                <img src="http://files.jb51.NET/upload/20090906120117884.jpg" />

                <h3><em>3. </em>An example title</h3>

                <p>
                    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin et felis eget
                    tellus pharetra porttitor. Praesent dui arcu, egestas quis, adipiscing a.
                </p>

                <span class="blue">100 sec</span>

            </div>

            <div>

                <img src="http://files.jb51.NET/upload/20090906120117490.jpg" />

                <h3><em>4. </em>An example title</h3>

                <p>
                    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin et felis eget
                    tellus pharetra porttitor. Praesent dui arcu, egestas quis, adipiscing a.
                </p>

                <span class="blue">120 sec</span>

            </div>

            <div>

                <img src="http://files.jb51.NET/upload/20090906120118968.jpg" />

                <h3><em>5. </em>An example title</h3>

                <p>
                    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin et felis eget
                    tellus pharetra porttitor. Praesent dui arcu, egestas quis, adipiscing a.
                </p>

                <span class="blue">140 sec</span>

            </div>

    </div>

</div>

<!-- next link -->
<a class="next"></a>

<!-- let rest of the page float normally -->
<br clear="all" />
<div>
    <input type="button" value="remove" id="remove"/>
</div>
<script type="text/Javascript"><!--
$(function() {        

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

    var scrollable=$("div.scrollable").scrollable();
    //alert(scrollable.getConf().prev);//獲取配置對象中的prev屬性
    scrollable.getConf().speed=200;//設置配置對象的speed屬性
    //alert(scrollable.getIndex());//獲取當前滾動項的索引
    //alert(scrollable.getItems().length);//獲取當前滾動項的數(shù)量
    //alert(scrollable.getItemWrap().html());//獲取包含滾動項的節(jié)點(class=scrollable),并將所有滾動項顯示出來
    //alert(scrollable.getPageAmount());//獲取當前滾動欄分頁數(shù)
    //alert(scrollable.getPageIndex());//獲取當前所在分頁
    //alert(scrollable.getRoot().html());//獲取滾動項的上一級節(jié)點(id=thumbs)
    //alert(scrollable.getSize());
    //alert(scrollable.getVisibleItems().length);//獲取當前可見滾動項數(shù)量
    scrollable.next();//如果有下一個滾動項,則跳轉(zhuǎn)到下一個滾動項
    scrollable.prev(3000,function(){return true});//跳轉(zhuǎn)到前一滾動項
    //var seekTo= scrollable.click(0).seekTo(2,1000,function(){
        //alert(this.getIndex());
    //});

    //scrollable.move(2);
    //scrollable.prevPage();//跳轉(zhuǎn)到前一頁
    //scrollable.nextPage();//跳轉(zhuǎn)到
    //scrollable.setPage(1);//跳轉(zhuǎn)到
    //scrollable.begin();//跳轉(zhuǎn)到第一個滾動項
    //scrollable.end();//跳轉(zhuǎn)到最后一個滾動項
    scrollable.click(3);//使第四個滾動項處于選中狀態(tài)

    scrollable.onBeforeSeek(function(){
            alert("you click the "+this.getIndex()+"st scrollable item!");
    });

    $("#remove").click(function(){
        scrollable.getItems().filter(":last").remove();//刪除最后一個滾動項
        scrollable.reload().prev();//自動更新相關配置信息,并跳轉(zhuǎn)到被刪除滾動項的前一項
    });

});
// --></script>

示例截圖

JavaScript技術jquery tools 系列 scrollable(2),轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 美女把屁股扒开让男人桶视频 | 国产91久久久久久久免费 | 中文字幕在线国产 | 国产色影院 | 成人xxx免费视频播放 | 欧美人体大胆私密视频 | 日本高清不卡二区 | 日本一区二区三区视频在线 | 欧美激情视频在线观看 | 久久国产香蕉一区精品 | 精品久久久久久久一区二区伦理 | 免费在线观看黄网站 | 手机在线亚洲 | 国产精品久久亚洲一区二区 | 久久中文字幕视频 | 91免费视频国产 | 色婷婷影院在线视频免费播放 | 国产精品热久久毛片 | 国产一区在线观看免费 | 国产精品极品美女免费观看 | 在线视频亚洲欧美 | 青草成人 | 久久国产精品99久久久久久牛牛 | 色成人综合网 | 91国语精品自产拍在线观看性色 | 久久五月女厕所一区二区 | 91国视频在线观看 | 欧美色综合图区 | 国产人成精品综合欧美成人 | 国内一级特黄女人精品毛片 | 亚洲国产中文字幕在线观看 | 香蕉视频成人在线观看 | 伊人精品视频在线观看 | 六月丁香六月婷婷 | 99久久国产综合精品国 | 日韩av成人 | 看全色黄大色大片免费久久久 | 在线视频一区二区三区在线播放 | 偷偷狠狠的日日2020 | 亚洲不卡一区二区三区在线 | 在线成人小视频 |