[Javascript] Moving elements/Interesting -page scroll behaviour
BEKIM BACAJ
trojani2000 at hotmail.com
Fri Apr 11 14:55:45 CDT 2003
NOTICE!
IE 5.0 can not set the mouse-move style with onmousedown event
but scrolls as far as you can drag outside the window!
And at contrary:
IE6 Can set the mouse apearence in time but doesn't scroll longer as the
mouse exits the window.
>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
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
More information about the Javascript
mailing list