|
||
| Inside Technique : IE5 Puzzler Behavior Our original puzzler wizard took any image on the web and turned it into a sliding puzzle. With help from Dave Massy our puzzler script has been converted to an Internet Explorer 5.0 behavior. By using behaviors, creating puzzles is so easy a wizard is no longer necessary. In addition, the puzzler degrades gracefully to display the initial image. Below is a demonstration. If you are running Internet Explorer 5.0 (beta 2 or later) you will see a puzzle. If you are running
a different browser, the standard image should be displayed.
Turning an image into a puzzle is easy:
Behaviors and any CSS property can be associated with existing HTML tags or with your own tags defined by your own
namespaces. The namespace defines the scope for the tag. For example, by default the existing HTML tags
are all within the HTML namespace. For exposing our behavior we chose to define a custom We defined the style of the puzzler's IMG element using CSS. While we only associated a behavior with the puzzler's img element, we also could have defined any of the other CSS properties. Associating a behavior with a tag is done using Internet Explorer's CSS behavior property. This property is set to the URL of the file defining the behavior. We defined the puzzler behavior using script in puzz.htc. Since this behavior makes sense only when viewing on the screen we define the behavior only for screen media. When printed, this element has no defined style and is essentially ignored causing the normal image to be printed instead. To create the puzzle we use our puzzler namespace and its img tag. Our puzzler img tag
supports two attributes, Internet Explorer 4.0 behaviors provide a great way to extend and enhance your web-page. They offer numerous advantages over including your script in-line. Behaviors
InsideDHTML also has a collection of Internet Explorer behaviors. Note that the syntax for behaviors has changed between Internet Explorer beta 1 and beta 2. Over the next few weeks, we are going to be reviewing and updating all our other behavior scripts and articles to use the latest syntax. Page 1:IE5 Puzzler Behavior © 1997-2000 InsideDHTML.com, LLC. All rights reserved. |