Click & drag a too-big page around in the browser window?

Click & drag a too-big page around in the browser window?

Post by Marti » Tue, 23 Aug 2005 12:36:53


I have some pages I'm serving out that are about twice the size of the
browser window (IE only; intranet only). The user must use the
horizontal and vertical scroll bars to move the page around.

Is it possible to have a javascript that would allow the user to click
and drag the page around (kind of like the new Google maps)? I already
have a ton of scripting in these pages - a few more lines won't hurt
anything.

Maybe someone could give me an idea of what such a script might look
like?

Thanks.
 
 
 

Click & drag a too-big page around in the browser window?

Post by |-|er » Tue, 23 Aug 2005 14:07:12

"Martin" < XXXX@XXXXX.COM > wrote in ...

this works ok, needs the pointer to change to a hand for the proper effect.

Herc


<body onMousemove="microsoftMouseMove()">

<script>
mousex = 0
mousey = 0

function microsoftMouseMove() {
oldx = mousex
oldy = mousey
mousex = window.event.x
mousey = window.event.y
if (window.event.button == 1) {
document.body.scrollLeft = document.body.scrollLeft - mousex + oldx
document.body.scrollTop = document.body.scrollTop - mousey + oldy
}
window.event.returnValue = false
}


</script>

<img src="test.gif" width=500><br>
<img src="test.gif" width=500>

</body>

 
 
 

Click & drag a too-big page around in the browser window?

Post by Ivo » Tue, 23 Aug 2005 14:11:42

"Martin" wrote

Do you mean something like this:
< http://www.yqcomputer.com/ ;

If so, then have a look at its script file here:
< http://www.yqcomputer.com/ ;

or with some Javascript syntax highlighting:
< http://www.yqcomputer.com/ ;

hth
Ivo
 
 
 

Click & drag a too-big page around in the browser window?

Post by Robi » Tue, 23 Aug 2005 22:36:48


why would you restrict people to use IE???


that would be "panning"?

If you have a wheel mouse where the wheel acts as third (middle) button,
you can use that (I mean, you're restricting your users anyway, while
this wouldn't restrict the users though ;-)


I don't know if it's unintentional, but besides the tree branches not
being aligned, if there is a "pan" function it ain't working on my
IE6 version.


function cbWindow(){
this.fail=1;
var n=window.navigator,an=n.appName.toLowerCase(),ag=n.userAgent.toLowerCase();
if(ag.indexOf("win")<0 || ag.indexOf("opera")>=0)
return;
var k=0,v_ie=0,v_nn=0;
if((k=ag.indexOf("msie"))>=0) v_ie=parseFloat(ag.substring(k+5));
else if(an.indexOf("netscape")>=0) v_nn=parseFloat(n.appVersion);
_ie=_nn=_mz=0;
if(v_ie>=4)_ie=1;
else if(v_nn>=5) _mz=1;
else if(v_nn>=4) _nn=1;
else return;
this.fail=0;
appName???? opera? win? netscape? aren't there any other browsers?
can't appName be spoofed?

oh, and on < http://www.yqcomputer.com/ ;

if (navigator.appName != "Microsoft Internet Explorer")document.write("Sorry, the browser you are using may not understand the
script on this page.\nTry accessing this page in Internet Explorer.")

is somewhat restricting 8-o
 
 
 

Click & drag a too-big page around in the browser window?

Post by Marti » Wed, 24 Aug 2005 01:54:41


Because the pages in question use VML to display a lot of graphic
items. And VML works only in IE. And, as I noted, these pages are
displayed only on an intranet (of a single company). And, such useage
is limited to about 4-5 people - all of whom use IE.

A question for you: why do you need an explanation of my situation (of
which you know nothing about)? I was looking for a technical answer to
a technical question.


Thanks you for the definition. I will be sure to use it the next time.


I believe the wheel mouse is capable of "panning" only in a vertical
direction. This wouldn't help in "panning" the page sideways.


It works OK in my IE6.
 
 
 

Click & drag a too-big page around in the browser window?

Post by Marti » Wed, 24 Aug 2005 01:57:58

Herc -

I used your script (slightly modified). Does just what I want.

Thanks