Search Results

Search found 98 results on 4 pages for 'droppable'.

Page 2/4 | < Previous Page | 1 2 3 4  | Next Page >

  • Get attribute of JQuery ui.draggable

    - by Jon
    Hi Everyone, I'm using JqueryUI for drag and drop on one of my pages and for some reason I can't seem to get an attribute of the ui.draggable object being passed into my droppable drop event. ui.draggable.attr("src") and $(ui.draggable).attr("src") both return undefined, however if I type ui.draggable.html() I will get the html back. Any ideas?

    Read the article

  • Getting the id of child element based on the parents class name

    - by sea_1987
    I am currently playing around with jqueries drag and drop, basically I currently have a div (.drag_check) that holds a checkbox, I have the drag and drop working but I want to alert out the checkbox's ID once the element is dropped, I assume I have to use child but all my attempts have returned 'undefined'. Below is my code, $('.drag_check').draggable({ containment: 'document', opacity:0.6, revert: 'invalid', helper: 'clone', zIndex: 100 }); $("ul.searchPage").droppable({ drop: function(e, ui) { var param = $(ui.draggable).attr('class') addlist(param) alert(param) } })

    Read the article

  • grouping draggable objects with jquery-ui draggable

    - by Jim Robert
    Hello, I want to use jquery draggable/droppable to let the user select a group of objects (each one has a checkbox in the corner) and then drag all the selected objects as a group... I can't figure out for the life of me how to do it haha. Here is what I'm thinking will lead to a usable solution, on each draggable object, use the start() event and somehow grab all the other selected objects and add them to the selection I was also considering just making the dragged object look like a group of objects (they're images, so a pile of photos maybe) for performance reasons. I think using the draggable functionality might fall over if you drag several dozen objects at once, does that sound like a better idea?

    Read the article

  • Saving JQuery Draggable Sitemap Values Correctly

    - by mdolon
    I am trying to implement Boagworld's Sitemap tutorial, however I am running into difficulty trying to correctly save the child/parent relationships. The HTML is as follows, however populated with other items as well: <input type="hidden" name="sitemap-order" id="sitemap-order" value="" /> <ul id=”sitemap”> <li id="1"> <dl> <dt><a href=”#”>expand/collapse</a> <a href=”#”>Page Title</a></dt> <dd>Text Page</dd> <dd>Published</dd> <dd><a href=”#”>delete</a></dd> </dl> <ul><!–child pages–></ul> </li> </ul> And here is the JQuery code: $('#sitemap li').prepend('<div class="dropzone"></div>'); $('#sitemap li').draggable({ handle: ' > dl', opacity: .8, addClasses: false, helper: 'clone', zIndex: 100 }); var order = ""; $('#sitemap dl, #sitemap .dropzone').droppable({ accept: '#sitemap li', tolerance: 'pointer', drop: function(e, ui) { var li = $(this).parent(); var child = !$(this).hasClass('dropzone'); //If this is our first child, we'll need a ul to drop into. if (child && li.children('ul').length == 0) { li.append('<ul/>'); } //ui.draggable is our reference to the item that's been dragged. if (child) { li.children('ul').append(ui.draggable); }else { li.before(ui.draggable); } //reset our background colours. li.find('dl,.dropzone').css({ backgroundColor: '', backgroundColor: '' }); li.find('.dropzone').css({ height: '8px', margin: '0' }); // THE PROBLEM: var parentid = $(this).parent().attr('id'); menuorder += ui.draggable.attr('id')+'=>'+parentid+','; $("#sitemap-order").val(order); }, over: function() { $(this).filter('dl').css({ backgroundColor: '#ccc' }); $(this).filter('.dropzone').css({ backgroundColor: '#aaa', height: '30px', margin: '5px 0'}); }, out: function() { $(this).filter('dl').css({ backgroundColor: '' }); $(this).filter('.dropzone').css({ backgroundColor: '', height: '8px', margin: '0' }); } }); When moving items into the top-level (without parents), the parentid value I get is of the first list item (the parent container), so I can never remove the parent value and have a top-level item. Is there a no-brainer answer that I'm just not seeing right now? Any help is appreciated.

    Read the article

  • jQuery UI Droppable: Detect which draggables are dropped on an element?

    - by Rosarch
    I have the jQuery UI framework's draggable and droppable elements working. I would like to programmatically determine which draggable elements are currently dropped on which droppable elements. Is there an easy way to do this? I thought of using event listeners to detect drop and out events, then keep a dictionary or something in memory to keep track, but this seems contrived. Better ideas?

    Read the article

  • How to get jQuery draggable elements scroll with mb.imageNavigator

    - by bulltorious
    I am using jQuery mb.imageNavigator (1.8) from http://pupunzi.open-lab.com/mb-jquery-components/mb-imagenavigator/ to implements a Risk type game adjucation system. Using the imageNavigator plugin I am able to scroll around a large game map of the world. My issue is when I declare some elements as draggable and drag them onto the map image, their location does not stay relative to where in the picture I put them. They just stay fixed on the screen no matter where I scroll. Does anyone know how to make the the draggable elements scroll with the image? Matteo posts about "you can add an additional content layer that overlay image and moves with it" and posts an example, but I can't make it work. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> ` <head> <script type="text/jscript" src="lib/jquery/jquery-1.3.2.js"> </script> <script type="text/jscript" src="lib/jquery/jquery-ui-1.7.2.custom.min.js"> </script> <script type="text/jscript" src="lib/utilities/mbImgNav.min.js_0.js"> </script> <script type="text/jscript" src="lib/utilities/start.js"> </script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>New Web Project</title> </head> <body> <div id="AdamsAshTray" style="float:right; background-color:red; z-index:999"> test test test </div> <div id="navArea"> <div imageUrl="someimage" navPosition="BR" navWidth="100" style="display:none;" class="imagesContainer"> <span class="title">zuccheriera</span> <div class="description"> <STRONG>description1</STRONG> </div> </div> </div> </body> $(document).ready(function(){ $("#navArea").imageNavigator({ areaWidth:1820, areaHeight:1000, draggerStyle: "1px dotted red", navOpacity: .8 }) $("#AdamsAshTray").draggable({ grid: [20,20] }); })`

    Read the article

  • jquery draggable into sortable only works after sorting

    - by Dao
    Hi, I'm experiencing problems with a simple combination of a Draggable and Sortable: initially, the dragging does not work and I do not get a receive callback. Only after I have done a sort (i.e. change the position of things in #workarea), can I drag new things into it. Somehow it seems as if the sortable needs to be 'initialized' before it accepts draggables. My code, in a simplified version: $(".element_draggable").draggable({ zIndex: 2, helper: 'clone', connectToSortable: '#workarea'}); $("#workarea").sortable({ receive: function() {alert('received');} }); Does anyone have an idea on what I could be doing wrong here?

    Read the article

  • How do I force jquery to center an element when it snaps to another container using the draggable method?

    - by David
    Here's my script. I want some square-shaped draggable objects (in this case just td boxes with numbers in them) to be able to snap to some empty table cells and snap to the center of those cells (empty td boxes), not the top or bottom of those cells, which is what is seems to do by default. <script type="text/javascript"> $(document).ready(function () { $(".inputs div").draggable( { snap: ".spaces" } ); }); </script>

    Read the article

  • How to trigger a postback using JQuery Droppable plugin ?

    - by Sandeep K Ram
    Hi, This is my script for the draggable and droppable <script type="text/javascript"> $(function() { $(".Source li").draggable({ appendTo: "body", helper: "clone", revert: "invalid" }); $(".Destination ").droppable({ activeClass: "ui-state-default", hoverClass: "ui-state-hover", accept: ".Source li", drop: function(event, ui) { $(this).find(".placeholder").remove(); $("#Hf1").val(ui.draggable.text()); $("#TxtItemId").val($("#Hf1").val()); } }); }); </script> Now I want to access the value of the "TxtItemId" control in the code-behind through a postback. How do I go about doing this ? BTW, this is for a scenario where a person will drag an item from a panel into a shopping cart and I need to capture the Id of the dropped item and trigger a postback after the drop to update the quantity of that item in the cart.

    Read the article

  • jQuery Nested Droppables

    - by John
    I have a nested set of jQuery droppables...one outer droppable that encompasses most of the page and an a set of nested inner droppables on the page. The functionality I want is: If a draggable is dropped outside of any of the inner droppables it should be accepted by the outer droppable. If a draggable is dropped onto any of the inner droppables it should NOT be accepted by the outer droppable, regardless of whether the inner droppable accepts the draggable. So that would be easy if I could guarantee 1+ inner droppables would accept the draggable, because the greedy attribute would make sure it would only get triggered once. Unfortunately the majority of the time the inner droppable will also reject the draggable, meaning the greedy option doesn't really help. Summary: The basic functionality is a set of valid/invalid inner droppables to accept the draggable, but when you toss the draggable outside any of the draggables it gets destroyed by the outer droppable. What's the best way of doing this?

    Read the article

  • Get the parent id..

    - by tixrus
    I have a bunch of elements like the following: <div class="droppableP" id="s-NSW" style="width:78px; height:63px; position: absolute; top: 223px; left: 532px;"> </div> They all have class droppableP but different id's obviously and I would like to factor the code in this script I am hacking on. The original script just has a specific selector for each of one of these divs, but the code is all alike except for the id it does things to, which is either the id of the parent or another div with a name that's related to it. Here is the original code specifically for this div: $("#s-NSW > .sensible").droppable( { accept : "#i-NSW", tolerance : 'intersect', activeClass : 'droppable-active', hoverClass : 'droppable-hover', drop : function() { $('#s-NSW').addClass('s-NSW'); $('#s-NSW').addClass('encastrada'); //can't move any more.. $('#i-NSW').remove(); $('#s-NSW').animate( { opacity: 0.25 },200, 'linear'); checkWin(); } }); Here is how I would like to factor so the same code can do all of them and I will eventually do chaining as well and maybe get rid of the inline styles but here is my first go: $(".droppableP > .sensible").droppable( { accept : "#i" + $(this).parent().attr('id').substring(2), tolerance : 'intersect', activeClass : 'droppable-active', hoverClass : 'droppable-hover', drop : function() { $(this).parent().addClass($(this).parent().attr('id')); $(this).parent().addClass('encastrada'); $("#i" + ($this).parent().attr('id').substring(2)).remove(); $(this).parent().animate( { opacity: 0.25 },200, 'linear'); checkWin(); } }); The error I get is $(this).parent().attr("id") is undefined Many thanks. I have browsed related questions the one I understand that's closest to mine, turns out they didn't need parent function at all. I'm kind of a noob so please don't yell at me too hard if this is a stupid question.

    Read the article

  • JQuery-UI Drag, Drop and Re-Drag Clones on Re-Drag

    - by amarcy
    I am using the following code to extend the JQuery-UI demos included with the download. I am trying to set up a container that the user can drag items into and then move the items around within the container. I incorporated the answer from http://stackoverflow.com/questions/867469/jquery-draggable-clone which works with one problem. <script> $(document).ready(function() { $("#droppable").droppable({ accept: '.ui-widget-content', drop: function(event, ui) { if($(ui).parent(":not(:has(#id1))")){ $(this).append($(ui.helper).clone().attr("id", "id1")); } $("#id1").draggable({ containment: 'parent', }); } }); $(".ui-widget-content").draggable({helper: 'clone'}); }); </script> div class="demo"> <div id="draggable" class="ui-widget-content"> <p>Drag me around</p> </div> <div id="droppable" class="ui-widget-header"> <p>Drop here</p> </div> When an item is dropped onto the droppable container it can be dragged one time and when it is dropped after that drag it loses its dragging capability. How do I allow for the item to be dragged multiple times after it has been added to the droppable container?

    Read the article

  • Help with this code.

    - by karthick6891
    Heading ##Hey guys i need help with this code.The short version is,i have to do match the follwing by using drag and drop in jquery and later i need to show a message whether it is right or wrong. var output = "Wrong"; var old_item ; var new_item ; var newObjArray=[]; $(function() { var $gallery = $('.gallery'), $trash = $('.trash'); $('div',$gallery).draggable({ revert: 'invalid', containment: 'document', helper: 'clone', cursor: 'move', }); // let the trash be droppable, accepting the gallery items $trash.droppable({ //accept: '#gallery div', //activeClass: 'ui-state-highlight', tolerance: 'touch', drop: function(ev, ui) { new_item = ui.draggable; $(this).droppable("option","activeClass",'.ui-state-highlight'); if(contains(newObjArray,ui.draggable)) { newObjArray.pop(ui.draggable); } newObjArray.push(ui.draggable); deleteImage(ui.draggable,$(this)); } }); // let the gallery be droppable as well, accepting items from the trash $gallery.droppable({ //accept: '#trash li', activeClass: 'custom-state-active', drop: function(ev, ui) { recycleImage(ui.draggable); } }); // image deletion function function deleteImage($item,element) { var $list; $item.fadeOut(10,function() { if($(".ui-widget-content", element).length <1){ old_item = $item; $list = $('<div class="gallery ui-helper-reset"/>').appendTo(element); //$('ul',$trash).length ? $('ul',$trash) : $('<ul class="gallery ui-helper-reset"/>').appendTo($trash); $item.appendTo($list).fadeIn(10); } else{ recycleImage($(".ui-widget-content",element)); $list = $('<div class="gallery ui-helper-reset"/>').appendTo(element); $item.appendTo($list).fadeIn(10); old_item = $item; } }); } //check for given answer // image recycle function function recycleImage($item) { $item.fadeOut(10,function() { $item.find("img").end().appendTo($gallery).fadeIn(10); }); } // image preview function, demonstrating the ui.dialog used as a modal window }); function checkOrder(){ if(newObjArray==null){ } else if(newObjArray!=null){ if(newObjArray[0].attr("id")=="5"&& newObjArray[1].attr("id")=="1" && newObjArray[2].attr("id")=="3" && newObjArray[3].attr("id")=="2" && newObjArray[4].attr("id")=="4"){ parent.parent.increaseCorrectA(); } else{ parent.parent.increaseWrongA(); } } } function contains(a, obj) { var i = a.length; while (i--) { if (a[i] === obj) { return true; } } return false; } I am calling the function checkOrder() from the html page after the matching of items is over.What happens here is i have just stored the user responses on the draggable over droppable in an array,based on it's position.It is a bad practice cause,i am saying whether it's right or wrong through its position in the array.The only thing i can do is get the draggable's id present in the droppable.But i dont know how to get that inside the function checkOrder().Any ideas please?

    Read the article

  • jquery drag and drop animation

    - by Cameron
    I have some UI functionality for drag and drop, but when an element is dropped, the animation makes it flit about all over the place for a split second before it appears in the newly dropped location. Can anyone advise how to tackle this, so that the draggable element moves more cleanly into place on success? ... success : function() { $(ui.draggable) .parent().droppable("option", "disabled", false) .end() .appendTo(droppable) .droppable("option", "disabled", true); }, ...

    Read the article

  • jQuery: Trouble with draggable across cloned elements

    - by Rosarch
    I'm trying to implement: User drags a draggable li to a droppable li. The original li is no longer draggable A new li is cloned from the original li, and is appended to the droppable li. I can't get it to work. function moveToTerm(original_course, helper, term) { var cloned_course = original_course.clone(true); original_course.addClass('already-scheduled'); original_course.draggable('disable'); cloned_course.draggable(); cloned_course.appendTo(term).hide().fadeIn('slow'); } This works fine, except now the cloned_course is not draggable. A droppable li: <li class="term ui-droppable"> <strong>Fall 2010</strong> <li class="course">Computing Cultures</li> <!-- this course was just dropped. I want it to be draggable but it's not --> <li class="course ui-draggable" style="display: list-item;">New Media and Society</li> </li> What am I doing wrong?

    Read the article

  • jQueryUI Ajax.NET Postback Bug

    - by nigative
    Hi, I have this ASP.NET page with ASP.NET UpdatePanel and jQueryUI droppable and sortable components. The page works fine in all browsers, but doesn't in Internet Explorer (IE8 tested). After I try to call ASP.NET AJAX event (by pressing my asp.net button inside the UpdatePanel) my sortable list stops working properly inside IE browser and the browser throws the following error: Message: Unspecified error. Line: 145 Char: 186 Code: 0 URI: http://code.jquery.com/jquery-1.4.2.min.js I found out that the problem is caused by the code on line 66: $("#droppable").droppable(); If I comment it out, the sortable list works fine after ajax postbacks. But it doesn't make sense. Does anyone know what could be wrong? Thanks. P.S. I am using jQueryUI 1.8.1 and jQuery 1.4.2

    Read the article

  • Jquery draggable persistence either through mysql or saving cookie in the database?

    - by Muhammad Jehanzaib
    I want to know that how can I persist the divs dropped on a draggable. I have been trying since long but stuck at this point. Actually you can see the demo here. I have to save the user designed wedding floor. So whenever user logins next time he/ she is able to see the last design saved. The code is shown below: $(document).ready(function() { $("#droppable").droppable({ accept: '.draggable', drop: function(event, ui) { $(this).append($(ui.draggable).clone()); $("#droppable .draggable").addClass("objects"); $(".objects").removeClass("ui-draggable draggable"); $(".objects").draggable({ containment: 'parent', }); } }); $(".draggable").draggable({ helper: 'clone', tolerance: 'touch', cursor:'move' }); });

    Read the article

  • How can I revert a 'draggable' upon failed AJAX request?

    - by Frank
    I have a draggable div, that needs to be dropped on a droppable. If it is dropped correctly, the droppable calls an AJAX request. If the draggable does not have a valid id or the AJAX request fails, the draggable should be reverted to it's original position. Is that something that can be done with jQuery?! Any help is greatly appreciated!! $("div.draggable").livequery(function(){ $(this).draggable({ revert: 'invalid', distance: 20 }) }); $("#trash").droppable({ tolerance: 'touch', drop: function(event, ui) { var item = ui.draggable; var id = item.attr('id'); if (id) { $.ajax( { type: "POST", url: "delete.php", data: "id=" + id, success: function(html) { if (html) { item.remove(); } else { // FAILED AFTER AJAX // is it possible to revert the draggable from here?? } } }); } else { // FAILED BEFORE AJAX // is it possible to revert the draggable from here?? } } });

    Read the article

  • change background color with change in mouse position

    - by Ashish Rajan
    I was wondering if it is possible to set background-color with help of mouse coordinates. What is have is: I have a DIV-A which is draggable and some other divs which are droppable. What is need is : I need to highlight other divs on my page which are droppable, whenever my DIV-A passes over them. What i have is mouse coordinates, is it possible to apply css on the bases of mouse coordinates using jquery.

    Read the article

  • jQuery: Prevent drop propragation over a draggable dialog

    - by Alban
    I have a page with some droppable <td elements and a dialog over the page with some draggable elements. When I drag an element over the dialog that is over a droppable <td, then elements drops inside it even if it is still being dragged over the dialog. Is there any way to prevent drop while the draggable is still over the dialog? For an example, see here: http://www.albanx.com/drop.jpg

    Read the article

  • JQuery UI drag and drop doesn't notice DOM changes happening during the dragging ?

    - by user315677
    Hi everybody, I have a html table in which each line (<tr>) represents a group of client computers. Each line can be expanded to show the clients belonging to the group. The <tr> containing the clients are always generated but hidden and showed when clicking the plus button at the beginning of each line. The clients themselves (they are <div>) can be dragged and dropped in another group as long as this group is already expanded. So far it works fine. What I am trying to achieve now is that the client can be dragged to a collapsed group and after a second or so hovering the group it will be expanded and the client can be dropped amongst the other clients of the group. I programmed the hover using the in and outevents of the droppable and it expands the group all right, but (and now it starts to be hard to explain with words ;) the behavior of the droppable (the client) is still as if the table line that appeared were not there : the in out and drop events of the droppable are fired on the old position of the elements, and the in out and drop events of the newly appeared <tr> are never fired. It looks as if JQuery memorizes the position, size etc. of the elements when the drag starts, and these values are not updated if there is a change in the DOM before the drop happens... Can someone confirm this behavior is normal, or can it be caused by another problem in my own code ? Any workaround ? (the question is quite bloated already so I don't include any code but I'll gladly upload it if required)

    Read the article

  • jquery ui draggable elements not 'draggable' outside of scrolling div

    - by Stu
    hello all, i am super stumped. i have many elements (floating href tags) in a div with a set height/width, with scroll set to "overflow: auto" in the css. this is the structure of the divs: <div id="tagFun_div_main"> <div id="tf_div_tagsReturn"> <!-- all the draggable elements go in here, the parent div scolls --> </div> <div id=" tf_div_tagsDrop"> <div id="tf_dropBox"></div> </div></div> the parent div's, 'tf_div_tagsReturn' and 'tf_div_tagsDrop' will ultimately float next to each other. here is the jquery which is run after all of the 'draggable' elements have been created with class name 'tag_cell', : $(function() { $(".tag_cell").draggable({ revert: 'invalid', scroll: false, containment: '#tagFun_div_main' }); $("#tf_dropBox").droppable({ accept: '.tag_cell', hoverClass: 'tf_dropBox_hover', activeClass: 'tf_dropBox_active', drop: function(event, ui) { GLOBAL_ary_tf_tags.push(ui.draggable.html()); tagFun_reload(); } }); }); as i stated above, the draggable elements are draggable within div 'tf_div_tagsReturn', but they do not visually drag outside of that parent div. worthy to note, if i am dragging one of the draggable elements, and move the mouse over the droppable div, with id 'tf_dropBox', then the hoverclass is fired, i just can't see the draggable element any more. thank you very much for any advice on helping me find a solution. this is my first run at using jquery, so hopefully i am just missing something super obvious. i've been reading the documentation and searching forums thus far to no prevail :( thank you for your time. UPDATE: many thanks to Jabes88 for providing the solution which allowed me to achieve the functionality i was looking for, here is what my jquery ended up looking like, feel free to critique it, as i am new to jquery. $(function() { $(".tag_cell").draggable({ revert: 'invalid', scroll: false, containment: '#tagFun_div_main', helper: 'clone', start : function() { this.style.display="none"; }, stop: function() { this.style.display=""; } }); $(".tf_dropBox").droppable({ accept: '.tag_cell', hoverClass: 'tf_dropBox_hover', activeClass: 'tf_dropBox_active', drop: function(event, ui) { GLOBAL_ary_tf_tags.push(ui.draggable.html()); tagFun_reload(); } }); });

    Read the article

  • jQuery drag drop slower for more DIV items

    Hi there, I have got a hierarchichal tags (with parent child relationship) in my page and it will account to 500 - 4500 (can even grow). When i bound the draggable and droppable for all i saw very bad performance in IE7 and IE6. The custom helper wont move smoothly and was very very slow. Based on some other post i have made the droppable been bound/unbound on mouseover and mouseout events (dynamically). Its better now. But still i dont see the custom helper move very smoothly there is a gap between the mouse cursor and the helper when they move and gets very bad when i access the site from remote. Please help me to address this performance issue. Am totally stuck here.. :(

    Read the article

  • When Drag a object from one div to another , format gets changed

    - by Anuj
    When a object is dragged and dropped from one div to another, the format in li gets changes to text only. I want it in the same format i.e 'li' after droping it. $(function() { $( "#catalog ul" ).sortable({ zIndex: 10000, revert: true }); $( "#catalog" ).accordion(); $( "#catalog ul" ).draggable({ appendTo: "body", helper: "clone", zIndex: 10000 }); $( "#dialogIteration ol" ).droppable({ activeClass: "ui-state-default", hoverClass: "ui-state-hover", drop: function( event, ui ) { $( this ).find( ".placeholder" ).remove(); $( "<li></li>" ).text( ui.draggable.text() ).appendTo( this ); } }).sortable({ items: "li:not(.placeholder)", sort: function() { // gets added unintentionally by droppable interacting with sortable // using connectWithSortable fixes this, but doesn't allow you to customize active/hoverClass options $( this ).removeClass( "ui-state-default" ); } }); $( "ul, li" ).disableSelection(); $("#dialogIteration").dialog(); }); Demo: http://jsfiddle.net/coolanuj/7683X/7/

    Read the article

< Previous Page | 1 2 3 4  | Next Page >