spacer

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

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

Logo

The DHTML Lab Jigsaw Puzzle, Part IV: Cross-Browser
creating the puzzle pieces


As you will recall, when the user presses the Break button, the breakUp() function is called, which in turn calls createPuzzle() to clip the pieces, which calls createPieces() to create the pieces, if a new image has been loaded.

The cross-browser version of these three important functions simply combines the Navigator and Explorer versions. There are very few differences in the code as you know it.

In createPieces(), we have added a statement that creates a showIt() method for all puzzle pieces, since their visibility is often toggled.

The first addition to breakUp() is the Explorer code for manipulating the width and height of elBlank. Remember, elBlank was introduced in the Navigator version of the code. It appears whenever a puzzle is broken in place of the image, creating a white workspace. In the original Explorer code, we simply made the image hidden, to create the workspace.

The second, very important, addition is the Navigator code for capturing the mousedown event. Now that our puzzle is broken, and puzzle draggability is off by default, we can enable mousedown capturing for moving our pieces. In the new scheme of things, therefore, Navigator only captures mousedown when the user moves over the puzzle image or the puzzle is broken and ready to be solved. Explorer still continues to capture mousedown universally.

As you can see, we have created the cross-browser version with very few additions. The remaining functions have even fewer modifications.


Produced by Peter Belesis and

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

All Rights Reserved. Legal Notices.
Created: Dec. 17, 1997
Revised: Jan. 18, 1998

URL: http://www.webreference.com/dhtml/column11/puzzCBcreate.html