spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column32


Stopping the Pages

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

The event handlers are consistent between the two browsers. To pause the scroll while a user mouses over the scrolling box, we added two event handlers to the scrolling pages, onmouseover and onmouseout (all lower case!). These events are defined for both firstPage and secondPage, as either one of them may be exposed at the canvas container. The definitions for the first page are:

firstPage.onmouseover = stopScrolling;
firstPage.onmouseout = scrollPages;

and similarly for the second page:

secondPage.onmouseover = stopScrolling;
secondPage.onmouseout = scrollPages;

The onmouseover event occurs when the mouse is placed over the scroll box. The onmouseout event occurs when the mouse is removed from the scroll box area. The event handler for the onmouseover event is the scrollPages() function which has been discussed on the previous page. It starts the pages going, just as the invocation of the program does in the first place:

function scrollPages() {
    Gtimer = setInterval("moveUp()", Ginterval)
}

The Gtimer variable stores a pointer to the setInterval() command, which invokes the moveUp() function every Ginterval milliseconds. The event handler of the onmouseout event is the stopScrolling() function which clears the Gtimer pointer and thus cancels the call to the moveUp() function, causing the pages to halt:

function stopScrolling() {
  clearInterval(Gtimer);
}

http://www.internet.com

Produced by Yehuda Shiran and Tomer Shiran

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint


Created: December 21, 1998
Revised: December 21, 1998

URL: http://www.webreference.com/js/column32/stop.html