jQuery拖拽 & 彈出層 介紹與樣本

來源:互聯網
上載者:User

iDrag & iDialog 介紹
特點:
iDialog.js依賴於jquery編寫的簡單易用的對話方塊,同時還可以通過添加css3,改變對話方塊的展現動畫。提供了兩個方法:

•1、拖拽函數 iDrag() 或 $.drag();
•2、對話方塊函數 iDialog() 或 $.dialog();
跨平台相容:
相容:IE6+、Firefox、Chrome等主流瀏覽器(其它暫時沒條件測試)。並且IE6下也能支援現代瀏覽器的靜止定位(fixed)、覆蓋下拉控制項。

漸進增強體驗:
確保IE家族功能完善的前提下,現代瀏覽器適當的添加css3增強體驗,如陰影、圓角、和scale show、super scale show 、right slide show動畫,動畫亦可自己修改css檔案進行擴充。

豐富的介面:
1.$.drag()函數,提供了拖拽範圍設定,拖拽前,拖拽過程,拖拽結束的回呼函數; 2.$.dialog()函數,提供了css3展示特效、大小、位置、顯示、關閉和外部存取介面等,更多參考後面的API。

快速入門:
<script src="lib/js/jquery-1.8.3.min.js"></script>
<script src="lib/js/jquery.idialog.js" dialog-theme="default"></script>
•jquery.iDialog.js是依賴jquery實現的,所以載入它之前必須載入jQuery;
•dialog-theme="default"表示將自動載入default.css樣式表;
•default.css必須儲存在theme檔案夾裡,且該檔案夾與jquery.iDialog.js需在同一目錄下。
iDrag()完整使用例子:
JS代碼:

複製代碼 代碼如下:
var log = $('#drag-demo-log');

  iDrag({

    target:'#drag-demo',

    min:{x:0, y:0},

    max:{x:658, y:170},

    start: function (pos) {

      log.html('start:x='+pos.x+', y='+pos.y);

    },

    move: function(pos){

      log.html('move:left='+pos.x+', top='+pos.y);

    },

    end: function(pos){

       log.html('end:left='+pos.x+', top='+pos.y);

    }

  });

一個iDialog()使用例子:
複製代碼 代碼如下:
iDialog({

      title:'Hello World',

      id:'DemoDialog  ',

      content:'<p>大家好:<br> 我是minDialog</p>',

      lock: true,

      width:500,

      fixed: true,

      height:300

  });

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.