jquery-ui-draggable

Destroy JQuery draggable

你。 提交于 2019-12-05 16:23:10
问题 I have a set of elements that are draggable. How can I remove draggable function? $('.draggable').draggable('disable') is not an option in my case $('.draggable').draggable('destroy') returns Uncaught TypeError: Cannot read property 'options' of undefined 回答1: From the jQuery UI API: destroy() Removes the draggable functionality completely. This will return the element back to its pre-init state. This method does not accept any arguments. Code examples: Invoke the destroy method: $( "

How to make dynamically added list elements draggable in jquery?

核能气质少年 提交于 2019-12-05 15:45:38
Here is my code from http://jsfiddle.net/XUFUQ/1/ $(document).ready(function() { addElements(); } ); function addElements() { $("#list1").empty().append( "<li id='item1' class='list1Items'>Item 1</li>"+ "<li id='item2' class='list1Items'>Item 2</li>"+ "<li id='item3' class='list1Items'>Item 3</li>" ); } $(function() { // there's the gallery and the trash var $gallery = $( "#list1" ), $trash = $( "#list2" ); // let the gallery items be draggable $( "li", $gallery ).draggable({ cancel: "button", // these elements won't initiate dragging revert: "invalid", // when not dropped, the item will

Odd Draggable Behavior After Implementing Auto Scroll

我是研究僧i 提交于 2019-12-05 15:04:41
I've implemented drag and drop using the jQuery UI draggable widget . I'm now implementing auto scroll during drag operations. I set it up so that when you start to drag, gray overlays appear at the top and bottom of the browser window. When you drag into one of these overlays, the browser window starts to auto scroll. You can see my test page at http://www.softcircuits.com/Client/scrolltest.html . Drag an item by dragging one of the crosshair icons on the left side. But there's a problem: if you scroll to the bottom of the page, and then drag an item to the top overlay, it will scroll up as

draw line with jquery between two divs

丶灬走出姿态 提交于 2019-12-05 13:16:49
how can I draw line between two div's with jquery library or simple javascript? I have various div's boxes on page with there id's id1 #id2 #id3 #id4 and #id5 and so on... what I wants if I click on #div1 and drag it to #div2 It will make an arrow line between #div1 and #div2 pointing to 2, And somehow save this connection details. Also i can attach #div1 to other div's and it save that connection details as well. (I am using jquery UI if that matters). Thanks for any help. i found http://jsplumb.org/ for this purpose. 来源: https://stackoverflow.com/questions/7707127/draw-line-with-jquery

Reposition element prior to dragging with jQuery UI

╄→гoц情女王★ 提交于 2019-12-05 13:02:06
This is an attempt to solve the problem of drag elements aligning to a grid (I outlined this in a previous question- Getting jQuery draggable to snap to specific grid ) So far I've established that the issue is that jQuery calculates the position of the element at the moment that .draggable() is called, and creates the grid relative to the element, instead of relative to the element's parent (which would be more intuitive). In the following solution, we see 3 boxes: Box 1 starts out at 0,0, and so will be aligned with the parent element's grid. Box 2 starts out at a point not aligned with the

Combining jQuery draggable, droppable, and sortable

十年热恋 提交于 2019-12-05 08:23:47
问题 I'm trying to combine jQuery draggable, droppable, and sortable; however, I keep having problems. Can anybody help me? Basically, the idea is illustrated here: A, B, C, D, E tiles can be moved between the upper droppable and the sortable. The custom (*) tile can be moved only between the left-side droppable and the sortable. Also, I'm trying to be able to deactivate and reactivate all these at any standing when necessary. This is what I have, but it's very buggy and not pretty: JS var

Move draggable to position programmatically

南笙酒味 提交于 2019-12-05 06:30:43
Lets say there is a draggable object capable of being dragged only on one axis. Is there a way to programmatically move it? Either to start, or by a delta. Of course I could go and change its css left property, but that wouldn't trigger the dragging events jQuery offers. I was expecting to find a dragBy(x,y) method to the draggable. Here is the example: http://jsfiddle.net/odyodyodys/daHU8/ html: <div id="theButton">Reset position</div> <div id="theDiv">Lorem ipsum dolor sit amet</div> Js: $("#theDiv").draggable({ axis: "x", cursor: "pointer" }); Css: #theDiv { display:block; width: 100px;

Dragging and Dropping onto a scaled element

点点圈 提交于 2019-12-05 04:26:05
I have a div element that I want to be able to drag onto a scaled element. However when I do this, the div element doesn't go to the right coordinates of the element but it does when I drag it around for the second time. I also think it scales up when the element get's added, which I want to try and avoid. Can anyone help me fix this? (especially the whole no going to the right spot thing) I've tried things like this to get the actual coordinates of the div but I'm not sure how to translate that over to the draggable element since mousemove doesn't work when I'm dragging something. $("body")

jQuery Draggable IFrameFix

两盒软妹~` 提交于 2019-12-05 02:36:53
I have a little problem with the jQuery Draggable IFrameFix. I have a container (as shown below) with an iframe inside of it. I turned on the iframeFix in my draggable setup, but it doesn't change a thing. Anyone who had the same problem or anyone who might know how to solve this? <div class="container"> <div class="toolbar"> <div class="opt1"></div> <div class="opt2"></div> </div> <iframe src="url" class="frame" frameborder="0" scrolling="no"><p>No support for iframes</p></iframe> </div> This if my javascript code. $(".container").draggable({ snap: ".snapper_col", containment: "#element

dragging from a sortable list to a drag and drop plugin

二次信任 提交于 2019-12-04 20:33:58
I am trying to allow dragging from a sortable list to a dynatree. My initial though was to specify something like this: $('#ews_pgs_clpbrd_items').sortable({ connectToDynatree: true }).disableSelection(); dynatree does not register the drag and drop events for the sortable items. so I tried $("#ews_pgs_clpbrd_items").sortable().disableSelection(); $("#ews_pgs_clpbrd_items li").draggable({ connectToDynatree: true, connectToSortable: "#ews_pgs_clpbrd_items" }); This allows the items in the sortable list to be dragged to the dynatree but it no longer allows sorting. When I try to sort I get the