類比iphone案頭切屏carousel小類庫

來源:互聯網
上載者:User

1)做什麼的:

由於翻遍jquery mobile,也沒有找到滿意的,類比iphone案頭切屏功能類庫。

分享一個最近寫的carousel小類庫,第一次發布,難免有些bug,後續維護。

主要針對智能行動裝置,類比iphone案頭切屏的小js類庫。

 

2)代碼和樣本地址:github:https://github.com/withasi/es_Carousel

一個樣本說明:http://61.155.178.185/c/

 

3)類說明如下:

  

/************** define: start  **************//** * @class:  Carousel類 * @example  var testCarousel = new es.Carousel("view","content") * @param overviewEl {HTMLElement|String} 為視角容器,為視角容器,即 Carousel的視角 * @param contentEl {HTMLElement||String} 為上邊容器的子容器,內容區的容器,寬度為page之和,為page頁面的父容器 * @param options {Object} 構造設定,參數說明: *           {                clientWidth : window.innerWidth, //客戶區寬度                clientHeight : window.innerHeight, //客戶區高度                swipeTime:300,//切換時間,單位為ms                pageSwitchThred:100,//頁面切換閾值,單位為px。表示當左右切換時,當切換的寬度為大於pageSwitchThred時,無論速度,在彈起時均切換                isIndicator:true,//是否建立指標                useTransform:true, //如果沒有採用transform,則直接通過改變style的top和left屬性                useTransition:true //如果沒有採用Transition,則設定style的top和left作為變換屬性,而非指定transform            } * @public */

 

4)應用舉例如下:

/************** example: start  **************/ <div class="view" id="view">     <div id="content" class="carouselContent">         <div class="contentpage">             <p>page 1</p>         </div>         <div class="contentpage">             <p>page 2</p>         </div>         <div class="contentpage">             <p>page 3</p>         </div>     </div> </div> </body> <script type="text/javascript">     window.onload = function(){         /**          * @description:  Carousel類          * @param overviewEl {HTMLElement||String} 為視角容器,為視角容器,即 Carousel的視角          * @param overviewEl {HTMLElement||String} 為上邊容器的子容器,內容區的容器,寬度為page之和,為page頁面的父容器          * @param options {Object} 構造設定          *           {                 clientWidth : window.innerWidth, //客戶區寬度                 clientHeight : window.innerHeight, //客戶區高度                 swipeTime:300,//切換時間,單位為ms                 pageSwitchThred:100,//頁面切換閾值,單位為px。表示當左右切換時,當切換的寬度為大於pageSwitchThred時,無論速度,在彈起時均切換                 isIndicator:true//是否建立指標             }          * @type {*}          */         var testCarousel = new es.Carousel("view","content");     } </script> /************** example: end  **************/

 

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.