Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2006
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Issue with scriptaculous custom onDrop in IE

    I'm attempting to modify the scriptaculous drag/drop behavuior so that when I drag an icon into a droppable, it makes a copy (same ID, class, etc) in the droppable, and removes the original.

    Here is the function I came up with to put in the onDrop parameter of my droppables:
    Code:
    function DropHandler(element,el){
    var newnode = document.createElement('img');
    var classname = element.className;
    newnode.src="img/"+element.id+".jpg";
    $(el).appendChild(newnode);
    newnode.setAttribute("class", classname);
    newnode.setAttribute("className", classname);
    debugger;
    element.parentNode.removeChild(element);
    newnode.id = element.id;
    new Draggable(newnode.id,{revert:true});
    }
    This code works perfectly in firefox, but in IE, after you drop it will continuously place a copy of the draggable elements onmouseup to whatever droppable my mouse happens to be over at the time of my mouseup.

    After a while it stops, but all my draggables are broken and do not work.

    This especially puzzling because it works *perfectly* as planned in firefox.

  • #2
    Regular Coder ohgod's Avatar
    Join Date
    Jun 2008
    Location
    Ohio
    Posts
    579
    Thanks
    6
    Thanked 69 Times in 69 Posts
    i hit an odd issue with drag\drop having issues in IE after a few. maybe 12-15 drap\drops and it would stop working until the page reloaded. never really found a good explanation.

  • #3
    New Coder
    Join Date
    Sep 2006
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    More info: Using more primitive debugging techniques, the error seems to be in the line " element.parentNode.removeChild(element);" commenting this out allows the rest of the code to function, but leaving it in throws an error of "object expected", it's hard to tell more without a debugger.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •