Нежелательное перетаскивание при прокрутке - PullRequest
1 голос
/ 13 декабря 2011

Я использую Jquery ui. Dragable.И когда я прокручиваю абзац, div перетаскивается одновременно с его родительским элементом.Может ли кто-нибудь помочь мне с Как временно отключить перетаскивание при прокрутке?

<div class="note">
        <p>
        Lorem Ipsum is simply dummy text of the printing 
        and typesetting industry. Lorem Ipsum has been the 
        industry's standard dummy text ever since the 1500s, 
        when an unknown printer took a galley of type and 
        scrambled it to make a type specimen book. It has 
        survived not only five centuries, but also the leap 
        into electronic typesetting, remaining essentially 
        unchanged. It was popularised in the 1960s with the 
        release of Letraset sheets containing Lorem Ipsum passages, 
        and more recently with desktop publishing software like Aldus 
        PageMaker including versions of Lorem Ipsum.
        </p>
</div>



$(function(){
            var str = "div.note";
            var el = $(str);
            var er = $(str+' p');
            $this = er;

            el.draggable().resizable();

            el.bind('resize', function(){
             var node = $(this);
             var size = Math.pow(node.width(),2) + Math.pow(node.height(),2);
             size = Math.sqrt(size);
             node.css({'font-size':(size/2)+'%', 'padding':(size/24)+'px'});
            });     
});

С наилучшими пожеланиями

1 Ответ

1 голос
/ 16 декабря 2011

Вы можете установить дескриптор:

http://jqueryui.com/demos/draggable/#option-handle

...

    el.draggable({handle: 'p'}).resizable();

...

здесь в jsFiddle: http://jsfiddle.net/s65UR/2/

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...