jQuery Easy UI Droppable(放置)組件

來源:互聯網
上載者:User

標籤:jquery   easyui   droppable   

Droppable(放置)組件也是一個基本組件,用法較簡單,文法都在例子裡面注釋了:

樣本:

<!DOCTYPE html><html><head><title>jQuery Easy UI</title><meta charset="UTF-8" /><script type="text/javascript" src="easyui/jquery.min.js"></script><script type="text/javascript" src="easyui/jquery.easyui.min.js"></script><script type="text/javascript" src="easyui/locale/easyui-lang-zh_CN.js" ></script><link rel="stylesheet" type="text/css" href="easyui/themes/default/easyui.css" /><link rel="stylesheet" type="text/css" href="easyui/themes/icon.css" /><script>$(function () {$.fn.droppable.defaults.disabled = true;//重寫預設值為true$('#dd').droppable({accept : '#box,#ipt',//設定哪些元素可以被接受disabled : false, //不單獨設定預設值時預設為false,當設定為true的時候則禁止放置。/*onDragEnter只觸發一次,而Over會在不停的拖動中不停觸發,  onDragEnter觸發的事件在移動過程中一瞬即逝,所以要想看清楚最好是看瀏覽器控制台,或者加個alert中斷一下。onDrop是放入到放置區,鬆開滑鼠左鍵,丟下的操作。*/onDragEnter : function (e, source) {console.log('曇花一現');$(this).css('background', 'blue');//alert('enter');},onDragOver : function (e, source) {console.log(source);$(this).css('background', 'orange');//alert('over');},onDragLeave : function (e, source) {console.log(source);$(this).css('background', 'green');//alert('over');},onDrop : function (e, source) {console.log(source);$(this).css('background', 'maroon');//alert('over');}});$('#dd').droppable('disable');//禁止$('#dd').droppable('enable'); //允許$('#box').draggable({accept : '#ipt',//設定哪些元素可以被接受disabled : false //不單獨設定預設值時預設為false,當設定為true的時候則禁止放置。});$('#ipt').draggable({});});</script></head><body><div id="dd" class="easyui-droppable"data-options="accept:'#box,#pox,#ipt'" style="width:600px;height:400px;background:#66ffff"></div><div id="box" style="width:100px;height:100px;background:#ccc;"><span id="pox">內容部分</span></div><div id="ipt" style="width:50px;height:50px;background:#ccc;">內容IPT</div></body></html>

點擊下載原始碼

jQuery Easy UI Droppable(放置)組件

聯繫我們

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