[Javascript] An image loader nearly working except for IE
Troy III Ajnej
trojani2000 at hotmail.com
Sat Jul 16 20:31:24 CDT 2005
All right, cliche does not mean no value strait ahead.
Taking pictures of nature is a cliche already, but taking great pictures of
nature, is an art.
The script I mentioned earlier is made for maps, scout maps etc., but it is
very suitable for other pictures that don't fit your screen also.
it should be 100% compatible with NN and IE all versions, not sure about
others.
here it is: (for aesthetic reasons please declare style="overflow:hidden" in
the <Body> tag)
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
[notice: if you have other window independable objects in the page (like
inputs etc) this script might return some errors, because selection will not
be disabled for this type of objects by this script and by default]
you may remove the set cursor lines in order to cut the script shorter.
I believe that making scripts targeting one browser only, is one of the best
ways to go.
but this mean that you always have to create the snifer page that will
direct the user browser to the right scipts and the right page dependable to
the broser system hitting it.
The 'this.complete' is god choice (almost universal) but the weaknes is in
the fact that it does not ocure as event. So you have to check its state
continuously. (I hate timers, they slow the system down) but it reveals it
self as the last resort in this casse.
Waiting to see your modified script, my adobe-like scroling script was
posted to this forum 2-3 years ago with rights etc but who cares now.
Regards
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
More information about the Javascript
mailing list