|
||
| Inside Technique : Animated Page Sets : Cross-Browser Issues Getting consistent results on both browsers proved to be quite the challenge. We originally authored and tested this article in Internet Explorer. When we finished the article and tested it in Netscape (with the object model differences already handled), we ran into one scripting issue and a number of style sheet issues. Script IssuesOutside of designing around the object model differences, the only
other scripting issue we experienced related to Netscape's implementation of JavaScript. We experienced a
bizarre problem with the SWITCH statement when trying to use our animation constants. Below
demonstrates how we originally coded all the switch statements:
While this ran fine in Internet Explorer, for some reason, this generated script errors in Netscape. Our fix was to hard-code the constant values into the switch statement (eg., case 1, case 2...). Style Sheet IssuesThis is where we hit the most difficulties. Our planned to define the appearance
of the page list using only global style sheets. Our original global style sheet was defined
as follows:
This stylesheet worked fine in Internet Explorer, but was completely ignored by Netscape. None of the elements were positioned, and the background colors were not applied. Instead, we discovered that in Netscape, the style sheet needed to be defined in-line on each element. Since Explorer
has no problems with the in-line style sheet, we moved from the global style sheet to a completely in-line one:
This got us very close. However, Netscape failed to correctly apply the background color to the entire positioned region.
The solution required two additional steps: 1) We needed to use a proprietary Netscape CSS property, layer-background-color and
2) We needed to embed a table within the positioned elements to make Netscape render the correct width. The complete HTML
to run on both browsers now is:
This gave us a solution that ran in both browsers. To run on Netscape, we give up some source code maintainability (loss of constants), and the reusability of CSS global style sheets and clean separation of style from content. Next, we provide the complete source code for the page animation library. Page 1:Animated Page Sets © 1997-2000 InsideDHTML.com, LLC. All rights reserved. |