Drag-Drop elements between parent frame and child iframe

AFAIK, if iframes come from different domains, this is not doable in a “common” way (unless you control both iframes), browser security measures prevent it, otherwise you could wrap a banking website and steal passwords, for example, when you log in. Some info on workarounds: http://softwareas.com/cross-domain-communication-with-iframes If you control both iframes: Drag & Drop between … Read more

How to exclude an element from being dragged in sortable list?

You need to use cancel. See working example here. Js: $(function() { $(‘.sortable’).sortable(); $(‘.sortable’).disableSelection(); $(‘.sortable’).sortable({ cancel: ‘.note’ }); });​ As @Zephyr points out, this let’s you re-arrange the position by dragging the siblings, if you want to avoid that, use owise1 approach: $(‘.sortable’).sortable({ items : ‘:not(.note)’ });

Getting the position of the element in a list when it’s drag/dropped (ui.sortable)

demo: http://so.lucafilosofi.com/getting-the-position-of-the-element-in-a-list-when-its-drag-dropped-ui-sortable/ SOLUTION: $(function() { $(‘ul#sortable’).sortable({ start: function(event, ui) { var start_pos = ui.item.index(); ui.item.data(‘start_pos’, start_pos); }, update: function(event, ui) { var start_pos = ui.item.data(‘start_pos’); var end_pos = ui.item.index(); alert(start_pos + ‘ – ‘ + end_pos); } }); }); NOTE: Updated to make use of jQuery data() method under advice of Alconja

Jquery sortable ‘change’ event element position

UPDATED: 26/08/2016 to use the latest jquery and jquery ui version plus bootstrap to style it. demo: http://so.lucafilosofi.com/jquery-sortable-change-event-element-position/ $(function() { $(‘#sortable’).sortable({ start: function(event, ui) { var start_pos = ui.item.index(); ui.item.data(‘start_pos’, start_pos); }, change: function(event, ui) { var start_pos = ui.item.data(‘start_pos’); var index = ui.placeholder.index(); if (start_pos < index) { $(‘#sortable li:nth-child(‘ + index + ‘)’).addClass(‘highlights’); … Read more

jQuery Sortable – drag and drop multiple items

One way is to create a custom helper with the selected items, hide the items while dragging and manually append the selected items upon receive. Here’s my attempt: css .selected { background:red !important; } .hidden { display:none; } script: $(‘.droptrue’).on(‘click’, ‘li’, function () { $(this).toggleClass(‘selected’); }); $(“ul.droptrue”).sortable({ connectWith: ‘ul.droptrue’, opacity: 0.6, revert: true, helper: function … Read more