jquery-ui-droppable

dragging items based on percentage to containment element

Deadly 提交于 2019-11-29 03:26:36
Here is what it looks like; $( "#box ul li" ).draggable({ helper: "clone" }); $( ".item" ).draggable({containment: ".door"}); $( ".door" ).droppable({ accept: ":not(.ui-sortable-helper, .item)", drop: function( event, ui ) { $( "<div class='item'></div>" ).html(ui.draggable.find("img")).appendTo(this); } }); User drags the $( "#box ul li" ) element and drops it on $(".door") element. And it appends it to $(".door") element with $(".item") selector. I am using jquery UI - Draggable to drag and drop items. There is no problem there. Here is the actual question; But when you start dragging the

jQuery Droppable, get the element dropped

ε祈祈猫儿з 提交于 2019-11-28 18:32:20
A small question hopefully with a simple answer, I am using jQuery draggable and droppable to place items into a dock. Using the below code for the drop. $("#dock").droppable({ drop: function(event, ui) { //Do something to the element dropped?!? } }); However I couldn't find a way to get what element was actually dropped, so I can do something do it. Is this possible? From the drop event documentation : This event is triggered when an accepted draggable is dropped 'over' (within the tolerance of) this droppable. In the callback, $(this) represents the droppable the draggable is dropped on. ui

jQuery droppable - allow only one item to be dropped on an element and then make the dropped one draggable again

穿精又带淫゛_ 提交于 2019-11-28 14:49:11
with jQuery droppable , I have multiple draggables and droppable as well. Only one draggable should be allowed to be dropped on an element at a time. However, after dropping, the draggable should be given the dragging capability again. The problem I am facing is that multiple draggable can be dropped on one element. My code follows: <div id="draggable_all" style="float: left; width: 300px;"> <div class="draggable">drag1111</div> <div class="draggable">drag2222</div> <div class="draggable">drag3333</div> </div> <div id="droppable_all" style="float: left; width:300px; "> <div class="droppable"><

jQuery UI drop event of droppable widget firing twice

孤街醉人 提交于 2019-11-28 10:51:38
Firstly, I know this question has been asked before, both in this site and others, but the answers are all rubbish for my scenario (if they're not rubbish entirely), and (at least for the question here: jQuery UI drop event of droppable fires on sortable ), the suggestion is just to turn off .sortable entirely, which is most certainly not what I want to do. Okay, I have this jquery (keep in mind if any options or html ids look silly, this is just for testing so I can try and figure this out): $(function () { $("#sortable").sortable({ revert: true }); $("#draggable, #draggable2").draggable({

jQuery UI Droppable and Sortable - dropping in the correct sort location

给你一囗甜甜゛ 提交于 2019-11-28 06:29:06
I'm working on a project where I'm dragging elements from a 3rd party jQuery control to a jQuery sortable, using a combination of droppable and sortable. This works perfectly fine, except the item being added is always added to the bottom of the sortable list, and you must then move it to the correct location as a separate step. Is it possible to have the item added to the location where you dropped it in the list? You can see this behavior in the jQuery shopping card droppable demo from here . Here is a jsfiddle of the same code. As you add items from the products to your cart at the bottom,

how to revert position of a jquery UI draggable based on condition

和自甴很熟 提交于 2019-11-28 04:56:09
I have an element which is draggable and an element which is droppable. Once the dragged item is dropped on the dropzone I am trying to execute the following jquery psuedo code: if(draggedelement == value){ $(draggedelement).hide(); } else{ $(draggedelement).revert(); } where the revert() function moves the dragged item back to its original postion. How would one accomplish this? P.S. I am aware of the draggable 'revert' option, however this only activates if the dragged item does not make it to the dropzone. There are some built-in options for this, on your .draggable() , set the revert

jQuery drag and drop - checking for a drop outside a droppable

最后都变了- 提交于 2019-11-28 04:40:21
My apologies if this was answered in another question, I could not find an answer specific to my problem! I'm trying to test whether a jQuery draggable is being dropped outside of a legal droppable. This would normally be solved 90% of the time by reverting the draggable, but I don't want to do that. Instead, I want to do one thing if the draggable is dropped onto a droppable (working great!), and something else if it is dropped outside of all possible droppables (currently getting the better of me!). In a nutshell: jQuery('#droppable').droppable( { accept: '#draggable', drop: function(event,

jQuery draggable and droppable between two containers and sortable

大兔子大兔子 提交于 2019-11-28 03:58:48
Im trying to develop a small page that has the following functionality: Page will have two divs: one being #origin, containing a lot of thumbnail images, and the second one will be #drop, where the images can be dropped on (up to 3 only). it needs to be possible to drag-drop the images from #drop back to origin. #drop needs to be sortable, since the order of the 3 selected images matter. When dropped on #drop, the images should align, as if they had original been displayed like that from the start. I had never used jQuery before, and I even had a working page prototype before, where I already

Drag and drop multiple selected draggables and revert invalid ones using Jquery UI

泄露秘密 提交于 2019-11-27 22:33:56
Drawing a box with cursor (lasso) will select multiple .item in this JSFiddle example . Selected .item 's become draggable. Empty .slot without an .item inside is a valid droppable. When you drop multiple draggables on multiple droppables, only the .item which mouse is on will revert if its corresponding droppable not valid. How to make every draggable revert if it's dropped on invalid droppable? Javascript: $(function () { // we are going to store the selected objects in here var selected = $([]), total = [], offset = { top: 0, left: 0 }; $(document).selectable({ filter: ".item", start:

How to get jQueryUI drag\\drop working with touch devices

守給你的承諾、 提交于 2019-11-27 19:18:30
This is one situation where I hope someone replies to tell me I'm an idiot. But I continue to be amazed that jQueryUI drag\drop doesn't work with touch devices. I have not tested them all but I have tried iphone\ipad\android 2, 3&4 over the last year and nothing. Just tried the latest version on a new Android. Still nothing. Don't believe me, just visit the demo page on a mobile device and try to use the drag\drop examples. Nothing. Is there a technical problem or core incompatibility in play here? A fix so easy that its not worth writing about? Do jQuery devs not use mobile devices? I have