spacer

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

home / experts / dhtml / column11
Developer News
Mozilla's Ubquity Mashup: For The Masses?
iPhone Users Just Want to Have Fun
Oops! I Fixed the Linux Kernel
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



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Performance Optimizations for High Speed JavaScript · Advanced Web Performance Optimization · Simple Comments Meets OpenID
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Extending Telephony: VoIP Call Recording for Business · U-Verse for Business Has Wi-Fi Perks · Lian-Li Launches New Power Supply Line, Rack Mount Kit and Fan Blower

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

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