Results 1 to 3 of 3

Thread: Help with DOM Drag & Drop script

  1. #1
    Join Date
    Nov 2008
    Location
    london
    Posts
    1
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Help with DOM Drag & Drop script

    1) Script Title: DOM Drag & Drop script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex11/domdrag/

    3) Describe problem: i want to make a type of game were you can drag images and drop them on to a another image, like them dress up games, i just dont know how to use more then 1 image to drag and drop, mybe if i give you the link to what i have done so far will help, http://www.freewebs.com/fizzypop-xx/dressup.htm this is the code i put in,

    HTML Code:
    <center><a href="http://s195.photobucket.com/albums/z138/yohanna101/?action=view&current=template.png" target="_blank"><img src="http://i195.photobucket.com/albums/z138/yohanna101/template.png" border="0" alt="Photobucket"></a></center><br/>
    <br/>
    <br/>
    <noscript></noscript><!-- --><script src="http://www.freewebs.com/p.js"></script><script type="text/javascript" src="http://fizzypop-xx.webs.com/dom-drag.js"></script>
    <img id="example" src="http://i195.photobucket.com/albums/z138/yohanna101/pinkskin.png" style="position: relative" />
    
    <script type="text/javascript">
    Drag.init(document.getElementById("example"));
    </script>
    
    <img id="example" src="http://i195.photobucket.com/albums/z138/yohanna101/purpleskin.png" style="position: relative" />
    
    <script type="text/javascript">
    Drag.init(document.getElementById("example"));
    </script>
    
    <img id="example" src="http://i195.photobucket.com/albums/z138/yohanna101/buleskin.png" style="position: relative" />
    
    <script type="text/javascript">
    Drag.init(document.getElementById("example"));
    </script>
    
    <img id="example" src="http://i195.photobucket.com/albums/z138/yohanna101/greenskin.png" style="position: relative" />
    
    <script type="text/javascript">
    Drag.init(document.getElementById("example"));
    </script>
    <div id="root" style="left:50px; top:50px;">
    <div id="handle">
    </div>
    Some text
    </div>
    
    <script type="text/javascript">
    var theHandle = document.getElementById("handle");
    var theRoot = document.getElementById("root");
    Drag.init(theHandle, theRoot);
    
    </script>
    
    <div id="thumb" style="position: relative; left:0; top:0;"></div>
    
    <script language="javascript">
    var aThumb = document.getElementById("thumb");
    Drag.init(aThumb, null, 0, 300, 0, 0);
    </script>
    
    <script language="javascript">
    var aThumbv = document.getElementById("thumbv");
    var scrolldiv=document.getElementById("scrollcontent");
    Drag.init(aThumbv, null, 0, 0, 0, 150);
    aThumbv.onDrag = function(x, y) {// x, y contains current offset coords of drag
    scrolldiv.style.top=y * (-1) +"px";
    }
    </script>
    
    
    <!-- --><script type="text/javascript" src="/i.js"></script><script type="text/javascript">if(typeof(urchinTracker)=='function'){_uacct="UA-230305-2";_udn="none";_uff=false;urchinTracker();}</script><script type="text/javascript" src="http://edge.quantserve.com/quant.js"></script> <script type="text/javascript">_qacct="p-44naSaXtNJt26";quantserve();</script>
    i would also like to know how you can flaten all the images that you drag and drop into one image.
    sorry if its confusing
    Last edited by Snookerman; 05-10-2009 at 05:55 AM. Reason: added [html] tags and “Resolved” prefix

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Replace:
    Code:
    <img id="example" src="http://i195.photobucket.com/albums/z138/yohanna101/pinkskin.png" style="position: relative" />
    
    <script type="text/javascript">
    Drag.init(document.getElementById("example"));
    </script>
    
    <img id="example" src="http://i195.photobucket.com/albums/z138/yohanna101/purpleskin.png" style="position: relative" />
    
    <script type="text/javascript">
    Drag.init(document.getElementById("example"));
    </script>
    
    <img id="example" src="http://i195.photobucket.com/albums/z138/yohanna101/buleskin.png" style="position: relative" />
    
    <script type="text/javascript">
    Drag.init(document.getElementById("example"));
    </script>
    
    <img id="example" src="http://i195.photobucket.com/albums/z138/yohanna101/greenskin.png" style="position: relative" />
    
    <script type="text/javascript">
    Drag.init(document.getElementById("example"));
    </script>
    With:
    Code:
    <img id="exampleA" src="http://i195.photobucket.com/albums/z138/yohanna101/pinkskin.png" style="position: relative" />
    
    <script type="text/javascript">
    Drag.init(document.getElementById("exampleA"));
    </script>
    
    <img id="exampleB" src="http://i195.photobucket.com/albums/z138/yohanna101/purpleskin.png" style="position: relative" />
    
    <script type="text/javascript">
    Drag.init(document.getElementById("exampleB"));
    </script>
    
    <img id="exampleC" src="http://i195.photobucket.com/albums/z138/yohanna101/buleskin.png" style="position: relative" />
    
    <script type="text/javascript">
    Drag.init(document.getElementById("exampleC"));
    </script>
    
    <img id="exampleD" src="http://i195.photobucket.com/albums/z138/yohanna101/greenskin.png" style="position: relative" />
    
    <script type="text/javascript">
    Drag.init(document.getElementById("exampleD"));
    </script>
    I hope this works, if you need to add more grudually increase the letter after "example." Ex:
    exampleA, exampleB, exampleC
    Jeremy | jfein.net

  3. The Following User Says Thank You to Nile For This Useful Post:

    ifizzypop (11-18-2008)

  4. #3
    Join Date
    May 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Nile, thanks for the answer. I am wondering about how to make the pic draggable???

Bookmarks

Posting Permissions

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