Drag 'n' Drop

  • Y2k88
  • Novice
  • Novice
  • Y2k88
  • Posts: 21

Post 3+ Months Ago

Here is a nifty idea (which leads to my question "Is it Possible") that I've got:

Is is possible to have a link, in the form of a text hyperlink or an iamge in a layer, that can be "Dragged 'n' Dropped" onto an iframe, which then opens the URL of that link inside the iframe.

Is this possible?

Seems kinda 'out-there' if u know what I mean. But I think it's something that's breaking the conventions of the normal onClick / href commands.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1855
  • Loc: Uk

Post 3+ Months Ago

Well the drag bit is easy. There are a few examples out there explaining how to do this.

http://www.walterzorn.com/dragdrop/dragdrop_e.htm
This page looks bloody good.

The drop part. Well you would have to test the co-ordinates of the mouse pointer onmouseup, and check to see if that lies within the area of the iframe. If it does then load the href of the link into the iframe. If not then just let the image/layer return to it's original position.

I guess it depends on how good your javascript is. There may be something already made that will do it all for you, but it would be hard to find. Plus it's no fun doing it that way :D

BTW, make it so that if the user just clicks on the link and javascript is disabled, it will just load the page using normal html.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

:? true it could be neat to see javascript do it, but wasn't Flash made for that kind of stuff ?
  • Ifrit
  • Graduate
  • Graduate
  • User avatar
  • Posts: 196
  • Loc: Portugal

Post 3+ Months Ago

flash was the easy way to allow anything to be done and then call it a site ^.^ (kind of)

nice site rtm :shock:
  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1855
  • Loc: Uk

Post 3+ Months Ago

joebert wrote:
:? true it could be neat to see javascript do it, but wasn't Flash made for that kind of stuff ?


Isn't it what the DOM was made for too :wink:

Bearing mind I have never ever even touched actionscript ever, but wouldn't you still need an onmousedown (or equivalent) handler and an onmouseup handler? Then a little code to move it with the mouse in between? And then a test to see if you have dropped it in the correct place?

That is all just assumed BTW, if flash has a much easier way to do it then fair enough. However, unless I've missed something, I'm not sure how flash would do this more easily or better than javascript, plus it would limit you to having an all-flash site.

Obviously if you wanted to make it more fancy then flash would definately be the way to go......
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

Actionscript has a a little combo consisting of "startDrag(), stopDrag(), _droptarget & onMouseUp()" made just for this kind of thing :D

rtm, "my next wish :wink: " would be for you to try flash for a month, I for one would be eager to see what you would come up with given your broad range of code understanding.

Come to the dark side :starwars:
  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1855
  • Loc: Uk

Post 3+ Months Ago

joebert wrote:
Actionscript has a a little combo consisting of "startDrag(), stopDrag(), _droptarget & onMouseUp()" made just for this kind of thing :D

Fair enough, like I said it was all assumed, so I'm happy to admit that I was wrong. Still I think drag and drop in JS could be made a lot easier than most people think.

Quote:
rtm, "my next wish :wink: " would be for you to try flash for a month, I for one would be eager to see what you would come up with given your broad range of code understanding.


Which wish you on now joebert, still "not quite three yet"? lol.

I would love to. I just don't have the time. I've got flash mx 2k4 installed and ready to rock, just no time to do any rockin' :P Bear in mind that this time last year, if you had said the word "tag" to me, I would have associated it with "name" rather than "html". I've still got as much to learn about web design and programming as anyone else, I just <i>pretend</i> to know it all :lol:

Flash is most definately on the to-do list, but seeing as I have no illusions of ever being artistic, it's further down the list than I might like. At the moment I'm working on making sites light-weight and accessible, whilst still looking prettyish

I'll make sure to show you my "red bouncing ball in a box with accurate gravity and restitution" .swf when I get round to making it lol.

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 54 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.