jQuery Easy UI Droppable(放置)組件,jquerydroppable
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 ui的droppable問題
你好!
可以在droppable的drop事件中,通過event得到來源物件,然後取出id,如下:
$( "#droppable" ).droppable({drop: function( event, ui ) {var obj = event.srcElement || event.target; alert(obj.id);$( this ).addClass( "ui-state-highlight" ).find( "p" ).html( "Dropped!" );}});
希望對你有協助!
jquery easy ui,window("open")
這個只有在左邊的架構頁面中加一個遮蔽層,當右邊架構頁面的遮蔽層顯示時,將左邊架構頁面的遮蔽層也同時顯示出來,反之也是一樣。實現起來應該不是很難。
為了達到效果,將左邊遮蔽層的右邊框設成無。