Ui.overState устарела?

0

Мой HTML:

<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
                        }
                });

Но я получаю значение alert is undefined Я ищу и не могу решить проблему, но согласно этому документу он существует. Итак, почему я не смог поймать ui.overState Если он устарел, предложите мне его альтернативу. Благодарю.

Пример скрипта: ui.overState

  • 0
    Вы включили JQuery UI?
  • 0
    ткни мою скрипку и попробуй себя.
Теги:

1 ответ

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
                        }
                });

см. демо

Ещё вопросы

Сообщество Overcoder
Наверх
Меню