jquery-ui-draggable

jQuery UI Draggable: Update containment on drag event

为君一笑 提交于 2019-12-06 22:07:30
Is this possible: Create a draggable element so that when it is dragged over a specific droppable element, the draggable element's containment option is set to the droppable element? This would create an effect where dragging something over a droppable element causes the draggable element to get locked/stuck to the confines of the droppable element. Below is an excerpt from my code, although it fails to accomplish the above effect. var droppable_position = $('#droppable').position(); $('#draggable').draggable({ helper: 'clone', drag: function (event, ui) { if (ui.position.left > droppable

jQuery Draggable IFrameFix

孤街浪徒 提交于 2019-12-06 20:58:06
问题 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>

JQuery UI : Drop long element at the cursor location instead of the middle of the element

血红的双手。 提交于 2019-12-06 16:34:03
问题 I have some very long draggable elements that I can drop in all cells of a background table. When I start dragging this kind of element hover my droppable containers (the cells of my table), the "hot" point to know where the element will be dropped is the middle of itself. Unfortunately, the middle of my element is often not visible and it is not useful to drop the element in the right place. Is it possible to specify the cursor position to choose in which container the element will be drop

Jquery drag and drop - click event registers on drop

女生的网名这么多〃 提交于 2019-12-06 14:15:20
I'm using jquery drag and drop. The draggable element is a div with two nested divs floated left and right. On drop, the left nested div (which contains the text), gets enabled for a click event: $('.element_left').click(function(e) { window.open(ui.draggable.attr('data-link')); }); Now on drop, sporadically, the click event fires off opening the link in the data-link for the draggable. It looks like it fires off when the draggable number doesn't match the slot number, but not 100% on this. See fiddle at http://jsfiddle.net/f2bbt/ Weird... You may need to try a few times to get this happening,

Avoid drop once that dropped items count reach some limit

删除回忆录丶 提交于 2019-12-06 14:12:33
I am using Jquery UI Draggable. I'm trying to avoid items from be dropped once that the div which will receive that items reach a limit. As you can see below, here is my code. $( "#grid-list" ).droppable({ over: function(event, ui) { count = 0; $("#grid-list").find("li").each(function () { count++; if(count > $("#grid-list").data("albumlist")){ alert("limit reached"); } }); } }); JS Fiddle example: http://jsfiddle.net/r1Lnxby9/ Edit, Updated Try removing ondragstart="drag(event)" , draggable="true" from html , drag not appear defined at js ; setting tolerance:"touch" at .droppable() options ;

Jquery UI Sortable multiple items almost working but one remaining issue

家住魔仙堡 提交于 2019-12-06 13:23:12
I have two connected sortables, dragging between these works fine. I needed to drag more than one at a time, so I got that working using the following like, appending selected items to event.item. $(this).sortable({ connectWith: ".stage-content", placeholder: 'placeholder', start: function(ui, e) { e.item.siblings(".selected").appendTo(e.item); .... The problem I can't figure out, when not hovering over one of the two drop zones, the placeholder ends up within the elements I am dragging. If you let go at this time, they disappear. HierarchyRequestError: Node cannot be inserted at the specified

Dynamically created external events not draggable

混江龙づ霸主 提交于 2019-12-06 12:27:18
I'm researching now for over a week and yet I can't drag my JSON value to external draggable divs to a Fullcalendar from Arshaw. Thanks to some help I have my json data loaded to the external divs. All looks correct, however after appending dynamically created divs to the div with 'external-events' class my events are not draggable anymore. If I add .draggable() to my newly created divs to the divs with '.external-event' class it becomes draggable but I can't drop them correctly to my calendar. A not draggable new div with the title value will appear under a new blank draggable div. It is so

How can I disable text-selection in webkit browsers when using jQuery UI .draggable?

时光毁灭记忆、已成空白 提交于 2019-12-06 12:24:13
问题 I can't seem to disable text-selection in webkit browsers when using jQuery UI .draggable(). I've tried using the webkit specific css (-webkit-user-select and -webkit-user-drag) in various combinations but haven't had any luck. Here's a jsfiddle where you can reproduce the problem: http://jsfiddle.net/dmosher/8ZGLR/ 回答1: disableSelection is your friend here. .disableSelection() is an undocumented (for now) core utility. It's useful for making text elements, or elements that contain text, not

Jquery draggable issue

谁都会走 提交于 2019-12-06 10:09:04
问题 Basically what I want is that while dragging, if I go outside the containment area and release the mouse click there, the draggable element just sticks to the border from where I left the containement area. And when I move my cursor back in, the element sticks back to the cursor. It doesnt looks nice when you are just moving your cursor(not dragging) and the element is still getting dragged. Here is a fiddle to play with. Just drag and release the cursor outside the output area, you will get

JQuery Draggable + Droppable + Sortable

怎甘沉沦 提交于 2019-12-06 09:51:07
I'm sure this has been answered before but I can't find an example to fit my situation. I've got a list of images that are draggable. I've also got a div (id="dropZone") that is set to droppable and sortable. I'd like to fire a function when the images get dragged and dropped on the div, but not when things are dropped on the div from being sorted. Here's what I tried: stop: function() { $('#dropZone').prepend('<img src"img.png" />'); } This I added to the droppable images, however this will fire even when they are dropped outside the droppable. drop: function() { $('#dropZone').prepend('<img