jquery-ui-draggable

How to swap 2 items using Draggable and Droppable?

孤街浪徒 提交于 2019-12-06 09:19:49
问题 Problem I have 4 images. User can drag and drop them to another list and change the order of the images. Target is that the users selects the order of the images. The problem is that I am unable to swap these images when they are place on each other. HTML <ul id="choices"> <li><img src="http://placehold.it/200x200&text=1" /></li> <li><img src="http://placehold.it/200x200&text=2" /></li> <li><img src="http://placehold.it/200x200&text=3" /></li> <li><img src="http://placehold.it/200x200&text=4"

jQuery UI Draggable function is not working

牧云@^-^@ 提交于 2019-12-06 06:45:17
问题 I've included the jquery library, afterward the jQuery UI library, and it still doesn't work. I am Using Google Chrome browser. code Follows: <script src="js/jquery-1.6.2.min.js" type="text/javascript"></script> <script src="js/jquery-ui-1.8.16.custom.min.js" type="type/javascript"></script> <script type="text/javascript"> $(function() { $( ".drag" ).draggable(); }); </script> <div id="aboutBox" class="boxLook boxBg drag"></div> I can't find any solutions anywhere. The debugger says that the

Detecting what jQuery UI's draggable function is hovering over

橙三吉。 提交于 2019-12-06 06:32:36
I'm attempting to have the dragged element detect where it's hovering over on the stop event for the jQuery's UI draggable function. Here is my attempt, however to no avail: $(".artwork").draggable({ stop: function(e, ui){ ui.mouseover(function(f){ if(f.target.id == "wall") { alert("yes!"); } }); } }); I'm not too sure I fully understand how I'd be able to detect what element I'm hovering over on the drag's stop event. Thanks! You might want to check droppable 's over event. $(".droppable").droppable({ over: function (event, ui) { var yourCurrentlyHoveredElement = $(this); //the 'this' under

jQueryUI manipulate draggable clone

寵の児 提交于 2019-12-06 05:21:42
EDIT: I Trimmed this question down, and put it on See how it's the original and not the new item that gets altered http://jsfiddle.net/mikkelbreum/DBG5q See how the dragged helper gets altered, but the element reverts back once it's dropped. http://jsfiddle.net/mikkelbreum/dpTC8 I've got a draggable list linked to a sortable list When I drag from draggable to sortable I use a cloned helper, so the original is still left in draggable collection. each time I drag a clone from the draggable list to the sortable list, I want to give the new copy a unique headline (manipulate it's h2 element). I

How to prevent draggable child elements from dragging over each other?

拟墨画扇 提交于 2019-12-06 03:55:01
How to prevent draggable child elements from dragging over each other in absolute position? Something like: if( ($("#firstChild").position().left) >= ($("#secondChild").position().left) ) { $(this).draggable({ disabled: true }); } but this only disables dragabble when stop dragging, the goal is to prevent from overdragging in some way...Or with Droppable??? Any ideas for CASE 2? EDIT: Also, this is maximum for child1 towards child2 , so no overlap occurs , but child1 can push child2 on right, and child2 can push child1 on left, important thing is that no overlap ocurrs! Some notes before / in

How to catch dragend event in javascript?

旧时模样 提交于 2019-12-06 01:51:47
问题 I'm trying to catch the dragend event in Javascript for a draggable DIV. The dragend event is not fired at all, why ? and how to solve this ? PS, I'm ussing .draggable() method from: jQuery UI 1.9.2 Here's my code: http://jsfiddle.net/vBMav/ HTML: <div id="divId"> ... </div> CSS: #divId { background-color: #000000; color: #ffffff; height: 200px; width: 200px; } Javascript: $('#divId').draggable(); $('#divId') .bind('dragstart', function(){ $("#divId").text("drag start"); }) .bind('drag',

jQuery drag and drop - Allow only one item in list

风流意气都作罢 提交于 2019-12-06 01:31:24
I work with this example from jQuery UI Sortable I have a problem with drag and drop. Table number 3 - sortable3 should only be able to receive one item. This is my HTML <div class="demo"> <ul id="sortable1" class='droptrue'> <li class="ui-state-default">Can be dropped..</li> <li class="ui-state-default">..on an empty list</li> <li class="ui-state-default">Item 3</li> <li class="ui-state-default">Item 4</li> <li class="ui-state-default">Item 5</li> </ul> <ul id="sortable2" class='dropfalse'> <li class="ui-state-highlight">Cannot be dropped..</li> <li class="ui-state-highlight">..on an empty

jQuery Draggable + Sortable - How to drag and drop between two scrollable lists

点点圈 提交于 2019-12-06 00:21:06
问题 I would like to have two lists, Available Items and Selected Items, whereby Available Items are assigned to Selected Items via drag and drop. I require the Selected Items to be sortable, but not the Available Items. The challenge is that both lists can potentially contain a significant number of items, and therefore need to be scrollable. Here is the jQuery I have thus far: <script type="text/javascript"> $(function() { $( "#available > li" ).draggable({ revert: 'invalid', connectToSortable:

Jquery UI combine sortable and draggable

♀尐吖头ヾ 提交于 2019-12-05 22:41:28
问题 I'm trying to combine a draggable panel (on top), and a sortable panel (bottom). Dragging works fine, but sorting fails. Here is my JS fiddle: http://jsfiddle.net/dmUKY/9/ Both drag'n drop and sortable functions shares the droppable:drop function. When sorting elements, the function has to replace the selected object. drop: function (event, ui) { //alert($(this).parent().html()); //alert($(ui.helper).attr('class')); var obj; if ($(ui.helper).hasClass('draggable')) { //alert('draggable'); obj

Clone draggable after dropping in targeted area with jQuery UI

独自空忆成欢 提交于 2019-12-05 19:22:17
I want some images to drop in a targeted area as many times as possible. But the image drops for only one time. My jQuery UI code: $(function() { $( ".draggable img").draggable({ revert: "invalid", appendTo: "#droppable", helper: "clone" }); $( "#droppable" ).droppable({ activeClass: "ui-state-default", hoverClass: "ui-state-hover", drop: function( event, ui ) { $( this ).find( ".placeholder" ).remove(); var image = $(".ui-draggable"); $( "<img />" ).image.src.appendTo( this ); } }); }); Please see the demonstration here: jsFiddle example From the example you see that the image drops in the