2013-11-25 58 views
0

我的HTML:ui.overState是否被棄用?

<ul id="tree"> 
    <li id="1">test1</li> 
    <li id="2">test2</li> 
    <li id="3">test3</li> 
    <li id="4">test4</li> 
</ul> 

和JQuery:

$("#tree li").draggable().droppable({ 

        element: '#tree', 
        tolerance: 'pointer', 
        aroundTop: '25%', 
        aroundBottom: '25%', 
        aroundLeft: 0, 
        aroundRight: 0, 
        drop: function(event,ui) { 
         alert(ui.overState);//desire result is 'top' ,'bottom' ,center 
         } 
       }); 

,但我得到警戒值是undefined。我搜索並不能解決根據this文件就存在一個問題,但。 那麼爲什麼我不能趕上ui.overState。如果它被棄用,建議我選擇它。謝謝。

樣品小提琴:ui.overState

+0

你包括jQuery UI的? –

+0

yap看到我的小提琴並嘗試你的自我。 –

回答

0

嘗試ui.position

$("#tree li").draggable().droppable({ 

        element: '#tree', 
        tolerance: 'pointer', 
        aroundTop: '25%', 
        aroundBottom: '25%', 
        aroundLeft: 0, 
        aroundRight: 0, 
        drop: function(event,ui) { 
     alert("top="+ui.position.top+" left="+ui.position.left);//desire result is 'top' ,'bottom' ,center 
         console.log(ui.position);// see in console 
         } 
       }); 

看到demo