473,395 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Stopping a function?

I wrote a "show div"* function that fires (and sets a DIV's "display"
style to '') when the user mouses over a certain area on the screen. I
also have a "fade div"** function that fires when the user moves the
mouse away from that area. This all works quite nicely.

But I'd like to add one more behavior...I'd like the div fade to stop if
the user happens to mouse over the popup div, and stay stopped so long
as the user remains within the boundaries of the div. If the user
leaves, then the fading would begin anew.

I tried adding the Show() function to the onmouseover event of the div,
but it continues fading even when I pass the mouse over it. Somehow I
need to stop the fading (fired by the onmouseout) and start the showing
fired by the onmouseover of the div.

I'd sure appreciate any help in solving this problem.

Thanks!

--Brent
*Show div
======================
var currentlyVisiblePopup;
function Show(e,divId,offsetX,offsetY,windowOrMouse)
{
if(windowOrMouse == "m")
{
offsetX = e.clientX + offsetX;
offsetY = e.clientY + offsetY;
}
if(currentlyVisiblePopup != divId)
{
if(currentlyVisiblePopup != null){Hide(currentlyVisiblePopup,0);}
var id = document.getElementById(divId);
id.style.display = '';
document.getElementById(divId).style.left = offsetX;
document.getElementById(divId).style.top = offsetY;
window.currentlyVisiblePopup = divId;
}
}
**Fade div
=====================
function fade(divId,opacity) {

if (document.getElementById) {
id = document.getElementById(divId);
if (opacity >= -10) {
setOpacity(id, opacity);
opacity = opacity - 10;
window.setTimeout("fade('"+divId+"',"+opacity+")", 100);
}
}
if(opacity < -10){Hide(divId,0);}
}
Dec 21 '05 #1
1 1498
Brent > wrote:
I wrote a "show div"* function that fires (and sets a DIV's "display"
style to '') when the user mouses over a certain area on the screen. I
also have a "fade div"** function that fires when the user moves the
mouse away from that area. This all works quite nicely.

But I'd like to add one more behavior...I'd like the div fade to stop if
the user happens to mouse over the popup div, and stay stopped so long
as the user remains within the boundaries of the div. If the user
leaves, then the fading would begin anew.

I tried adding the Show() function to the onmouseover event of the div,
but it continues fading even when I pass the mouse over it. Somehow I
need to stop the fading (fired by the onmouseout) and start the showing
fired by the onmouseover of the div.

I'd sure appreciate any help in solving this problem.


Create an object that does the fading and stores the relevant values and
references.

Give the object a start and stop method. Start and stop it as appropriate.

If you want to do multiple simultaneous fades, make a constructor that
builds a fade object for each element being faded. Start and stop them
as appropriate - you may need another object to keep references to the
fade objects you've created and to destroy them when they've finished.
[...]
--
Rob
Dec 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Daniel O'Brien | last post by:
Hi - any help with this would be greatly appreicated - it has already had me confused for a good few hours! I am using Visual Studio 2003 and the .NET framework 1.1. I have a C# Windows...
8
by: saif | last post by:
Hi all, I realy need your help. I have a page with different web links, now what I am trying to do is whenever a user clicks on a link that link is captured using event.target method. I'm...
6
by: Dave | last post by:
I have a situation where I want to react to a ctrl-click on a <span> and it works in Netscape and Firefox browsers but in IE I have a problem. In IE I do catch the ctrl-click but IE also renders...
6
by: D | last post by:
I have a simple file server utility that I wish to configure as a Windows service - using the examples of the Python Win32 book, I configured a class for the service, along with the main class...
1
by: mclaugb | last post by:
Here is a simple piece of thread code. When i add the print (or other) function into the run method--the thread fails to stop after 2 seconds which the join(2) should ensure. I have a function...
6
by: blaine | last post by:
Hello, I'm currently overriding function keys (F1 to F4) to perform other actions. In order to do this the default popup windows of Help (F1), Seach(F3) etc must be turned off. In FF it's easy...
0
by: eldamiani | last post by:
Ineed a help. I want to ask, how I can do dialog box window which is a normal form, but causes stopping the code execution in form which call out this dialog box. I have ...
6
by: naurus | last post by:
i'm making a javascript visualization effect, and i'm having some trouble with the stopping the main function when a certain particle reaches 100% height: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML...
2
by: Steve | last post by:
Hi All, I've been trying to come up with a good way to run a certain process at a timed interval (say every 5 mins) using the SLEEP command and a semaphore flag. The basic thread loop was always...
1
by: raghudr | last post by:
Hi all, I am displaying a splash screen for which i have created a thread.Since my whole project is launched by windows service and that service will start automatically at the start of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.