Made a small change to accomodate multiple nots

23 views
Skip to first unread message

gjma...@gmail.com

unread,
Sep 8, 2016, 2:39:16 PM9/8/16
to threedubmedia
jQuery(function ($) {
            $('.drag').drag(function (ev, dd) {
                $(this).css({
                    top: dd.offsetY,
                    left: dd.offsetX
                });
            }, { not: ['a', 'img'] }); // this is where I am passing an array of strings of selectors
        });


Change in the code is as follows:

FROM:

if if ( $( event.target ).is( dd.not ) ) 
return;

TO:

if (dd.not.indexOf($(event.target)[0].localName ) !== -1)
return;
Reply all
Reply to author
Forward
0 new messages