[Javascript] Onmousemove event

Iztok Polanic iztok.polanic at amis.net
Wed Jul 28 02:20:25 CDT 2004


Hi!

Thanks. That worked!

Bye,

Iztok 

-----Original Message-----
From: javascript-bounces at LaTech.edu [mailto:javascript-bounces at LaTech.edu]
On Behalf Of Peter Brunone
Sent: 28. julij 2004 0:13
To: '[JavaScript List]'
Subject: RE: [Javascript] Onmousemove event

Iztok,

	The problem is that when you set display = 'none', the browser
thinks that "well, the object doesn't exist here right now, so the mouse
pointer isn't over it and I should show it again".  Add this line after
you set visinaPos and you'll see what I mean:

window.status = "Mouse X: " + tempX + "; Mouse Y: " + tempY + ";
LeftPos: " + leftPos + "; TopPos: " + topPos;

	LeftPos and TopPos become zero when display is set to none.
You'll have to either use visibility instead of display, OR store the
leftpos and toppos values in additional variables and ignore the values
from the object when it's not being displayed (a third option would be
to find out if some other positioning properties retain their values in
this situation, but I doubt that is the case).

Cheers,

Peter Brunone
_______________
EasyListBox.com

-----Original Message-----
From: javascript-bounces at LaTech.edu On Behalf Of Iztok Polanic

Hi!

Me again. I hope this time without quarrell. :) Below is a script which
works find in IE but not so good in Firefox.

var IE = document.all ? true : false;	
	
if (!IE) {
	window.captureEvents(Event.MOUSEMOVE);	
	window.onmousemove = mouse_move;
} else 
	document.onmousemove = mouse_move;		

function mouse_move(e) {
	if (IE) {
		tempX = event.clientX;
		tempY = event.clientY;
	} else {
		tempX = e.pageX;
		tempY = e.pageY;
	}
	
	// lay
	leftPos = document.getElementById('lay').offsetLeft;
	topPos = document.getElementById('lay').offsetTop;
	sirinaPos = document.getElementById('myrange').offsetWidth;
	visinaPos = document.getElementById('myrange').offsetHeight;
	
	if(tempX >= leftPos && tempX <= (leftPos + sirinaPos) && tempY
>= topPos && tempY <= (topPos + visinaPos)) 
		document.getElementById('lay').style.display = 'none';
	else
		document.getElementById('lay').style.display = '';
}

In Firefox the picture is displaying and dissapiring. Why? How can this
be fixed?

Bye,

Iztok


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




More information about the Javascript mailing list