473,375 Members | 1,309 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,375 software developers and data experts.

Draggable Divs

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
5 2559
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
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

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
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
> 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: rdlebreton | last post by:
Hi, Folks! I've been trying to develop my own version of these draggable layers and I have been limiting myself to IE6...for now. I have looked at some other examples to get ideas of creating...
2
by: louissan | last post by:
Hi all, I have a slight problem with IE, when everything works with firefox. The goal is to _create_ boxes using the createElement method. And then making it draggable with the mouse. The code...
2
by: Sam Marrocco | last post by:
Is is possible to make vb.net controls such as a checkbox or button draggable while an app is running, thereby allowing the user to "re-design" the layout of buttons on a form? --...
0
by: Showjumper | last post by:
On pageflakes you can drag the panels around but they will snap to specific localtions. How can i do this using the dragoverlayextenders and ATLAS? Right now i have it so the panels are draggable...
3
by: Jason | last post by:
I have a hyperlink that is draggable (using Prototype's "new Draggable()" construct). I want to be able to drag the link without actually 'clicking' the link once i end the drag. Is there a way to...
1
by: tehweb | last post by:
Background: I have a fixed position div on the bottom om my page. I have then added a dialog-div into this fixed position one. When I bring up the dialog, everything works if the the scrollTop is...
3
by: Sebarry | last post by:
Hi, I have been assigned the daunting task of applying coordinate movements of a draggable div with a small box to the scrolling of the current window. Basically the small box represents the...
6
by: vunet | last post by:
Hello, I hope this is a right place to ask about Scriptaculous library. I started using draggable and droppables effects for the first time and my draggable is simply initialized as new...
6
by: cleary1981 | last post by:
I have adapted code from http://dunnbypaul.net/js_mouse/ I want to use a button to create new draggable divs but i keep getting error "is null or not an object" heres the code <html> <head>...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.