javascript - What does ui.draggable.draggable means? -
i new javascript , have stated learn javascript. came across piece of code .i know use , meaning of
ui.draggable.dragabble
in code shown below
drop:function(e,ui){ var drag = ui.draggable; $(this).droppable('option', 'accept', drag); drag.css({'top':$(this).css('top'),'left':$(this).css('left')}); drag.draggable('option', 'revert', function(){return false}); var drop_index=$(this).attr("id").split('_')[1];
i know sites learn drag , drop in javascript,in better way.
any appreciated in advance.
"ui.draggable" refers object containing elements being dragged on page.
the function
drop: function(e, ui) { }
is executed when draggable object dropped on droppable element. can refer jquery-ui api documentation here: http://api.jqueryui.com/category/interactions/ drag , drop functionalities. point , apt. check demos. start demos better grasp of it.
for drag , drop:
- html5 has attributes 'draggable="true"' can add elements. can attach events handledrag, handledrop etc required functionality. check here: https://www.html5rocks.com/en/tutorials/dnd/basics/
- jqueryui has interactive widgets can added page elements. pretty simple grasp. refer above link mentioned exploring. can use touch-punch library http://touchpunch.furf.com/ make jqueryui work on mobile devices well.
- you can write own pure javascript drag , drop function. found 1 here: https://github.com/lukasolson/drag-n-drop-js .
i know these 3 ways drag-and-drop. there might others well.
Comments
Post a Comment