Pierre-Yves
07-21-2009, 06:50 PM
I have a small javascript which allows to pan across a large picture (like a big map, much larger than the current window) in any direction, with a simple click and drag (just like the hand cursor of acrobat reader).
The problem : it works only in IE and not in FF, and I don't understand why !
Could anybody help ?
I've put a large but very light map.jpg in attachment.
Here's the HTML :
<html><head><title>panning across a large picture</title>
<META HTTP-EQUIV="imagetoolbar" CONTENT="no">
<script type="text/javascript">
document.onmousedown = function(){
var e=arguments[0]||event;
var x=document.body.scrollLeft+e.clientX;
var y=document.body.scrollTop+e.clientY;
document.onmousemove=function(){
scrollTo(x-e.clientX, y-e.clientY);
return false;
}
document.onmouseup=function(){
document.onmousemove=null;
}
return false;
}
// End -->
</script>
</head>
<body style="cursor: hand" oncontextmenu="return false" onselectstart="return false" ondragstart="return false">
<img src="map.jpg" border="0">
</body>
</html>
The problem : it works only in IE and not in FF, and I don't understand why !
Could anybody help ?
I've put a large but very light map.jpg in attachment.
Here's the HTML :
<html><head><title>panning across a large picture</title>
<META HTTP-EQUIV="imagetoolbar" CONTENT="no">
<script type="text/javascript">
document.onmousedown = function(){
var e=arguments[0]||event;
var x=document.body.scrollLeft+e.clientX;
var y=document.body.scrollTop+e.clientY;
document.onmousemove=function(){
scrollTo(x-e.clientX, y-e.clientY);
return false;
}
document.onmouseup=function(){
document.onmousemove=null;
}
return false;
}
// End -->
</script>
</head>
<body style="cursor: hand" oncontextmenu="return false" onselectstart="return false" ondragstart="return false">
<img src="map.jpg" border="0">
</body>
</html>