By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,628 Members | 1,692 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,628 IT Pros & Developers. It's quick & easy.

Draggable Divs

P: n/a
Hi

I am trying to allow a user of a web site to move an image around the page
using draggable Divs. I have tried using some script from
http://www.mattkruse.com/.

In particular: http://www.mattkruse.com/javascript/dragiframe/ which caters
for draggable IFrames. I think I can use the same code for Divs but I have
no success as yet.

I have to following code but I can not work out what I am doing wrong.

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb"
Inherits="ImageUpload.WebForm1"%>
<SCRIPT language=javascript src=dragiframe.js></SCRIPT>
<STYLE>.drag{position:absolute; cursor:hand;}</STYLE>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>WebForm1</TITLE>
</HEAD>
<!--<BODY onLoad="addHandle(document.getElementById('div1'), window);">-->
<BODY onLoad="addHandle(document.getElementsByTagName(Di v).item(0),
window);">
<DIV id="div1" name="div1" class="drag"
style="width:30;height:30;top:200;left:200">
<IMG src=cross.gif>
</DIV>
</BODY>
</HTML>

Can anybody identify where I am going wrong or if I am missing anything?

Regards, Carl

Note: I have also downloaded dragiframe.js and placed it in the same folder
as the web page.
Jul 23 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Without knowing what's in dragiframe.js it's hard to know what the
problem is. Try adding position: absolute in your div to allow it to
actually be positioned anywhere.

Jul 23 '05 #2

P: n/a
Carl Gilbert wrote:
Hi

I am trying to allow a user of a web site to move an image around the page
using draggable Divs. I have tried using some script from
http://www.mattkruse.com/.

[...]

The script specifically looks for an IFRAME (see line 175).
You need to make it look for a div and manage the other parts of
the code that require an IFRAME not a div.

Maybe Matt is lurking?

Why not just use an IFRAME and be done with it?
--
Rob
Jul 23 '05 #3

P: n/a

http://www.mattkruse.com/scripts/sup...&LastLogin=You
could also try posting on Matt's forum. Maybe someone has already done
it:

Jul 23 '05 #4

P: n/a
Carl Gilbert wrote:
Hi

I am trying to allow a user of a web site to move an image around the page using draggable Divs.


(snip)

This is hard to beat (check out the "Optional Commands" in particular).

http://www.walterzorn.com/dragdrop/dragdrop_e.htm

Jul 23 '05 #5

P: n/a
> This is hard to beat (check out the "Optional Commands" in
particular).
http://www.walterzorn.com/dragdrop/dragdrop_e.htm

This is a great site. Thanks for the tip.

Carl

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.