[Javascript] Moving elements

Andrew Gibson andyg at ihug.co.nz
Fri Apr 11 18:31:24 CDT 2003


Bekim, I've copied this script as is....what is it supposed to do.....

Just comes up with object required when I try to drag something.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Subject: Re: [Javascript] Moving elements


Sorry I left without a notice, but i had to. Long time planin a short
vacation up the mountains, -the very tops, ups!

Very cold weather and furious snowy winds, wisibility='hidden' but it pays.

Anyway,
here is the script for acrobat-like movement i've written that day:

/*********************************************************************
Title:       "Acrobat-Like" Page Scroll Script
Written by:   Bekim Bacæ Trojani
Date:         1:10 PM 4/1/03
Instructions: To remove scrollbars and retain scrollability
      Include: style="overflow:hidden" in the <Body> tag
Compatibility:IE only (this version) version 1.0ie(beta)
**************Please keep this coment lines if you use it*************
**********************************************************************/
var x, y, dx, dy, dB=document.body;
function enableMove(){
dB.style.cursor="move" //can't make it work!
          x=event.screenX
y=event.screenY
    dx=x+dB.scrollLeft
    dy=y+dB.scrollTop
}

function movingNow(){
if (window.event.button==1) {
x=event.screenX
y=event.screenY
   dB.scrollLeft = 0-(x-dx)
   dB.scrollTop  = 0-(y-dy)
        dB.style.cursor="move"
}
}

function setItBack(){dB.style.cursor='';}

function retF(){return false}

document.onmousedown  =enableMove
document.onmousemove  =movingNow
document.onmouseup    =setItBack
document.onselectstart=retF
document.ondragstart  =retF

It works as charm, very usefull for maps, especialy in popup windows etc.

Excuse my math, is't very unconvetional.

Once you've played around with this script, you will allready miss it at
other pages.
(P.S. Might work perfect in >NN4 also, but never tested it)

Cheers!





>From: "Andrew Gibson" <andyg at ihug.co.nz>
>Reply-To: "[JavaScript List]" <javascript at LaTech.edu>
>To: "[JavaScript List]" <javascript at LaTech.edu>
>Subject: Re: [Javascript] Moving elements
>Date: Wed, 2 Apr 2003 10:57:21 +1200
>
>====================================
>Subject: Re: [Javascript] Moving elements
>
>Pardon me for being a dummy, but where on your site do the coding examples
>you cite actually live?
>====================================
>Right here, but they're not coding samples, just demos of the code....but
>anyone can do a view source for   the code, and you have to view in ie6 for
>the dragging example
>
> > www.dscript.net.nz
> >
> > then select display, dragging
>then click example, and drag the image
>
>=====================================================================
>[P.S:  I don't believe in "API Development Tools" either.  Every one I've
>ever seen is riddled with bugs and incompatibilities, and the learning
>curve
>is so steep you never catch up with what the "contemporary" package looks
>like.  I'm from the OLD days, when men were men, and sheep ran scared, and
>programming required chipping the 1's and 0's out of granite with your bare
>hands.]
>==============================
>Not even sure what API dev tools are to be honest, with regards to jscript,
>but if you mean programs like dreamweaver to create code, I agree.....in
>fact I've never even used anyone elses code without some major rejigging
>for
>my own uses.
>
>Cheers
>Andrew Gibson
>
>
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript


_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript




More information about the Javascript mailing list