There’s one script file that we need to include on the web page, and that’s sifr.js—you’ll
find it in the package you downloaded from the official sIFR site. To start out, it just needs
to be inserted in the head of your page:
flash-replacement.html (excerpt)
You’ll need to take a look inside the JavaScript file to configure the file specifically for the
site. You don’t need to be concerned with most of it—it’s 11KB of tricky Flash detection
and DOM manipulation—but right at the bottom you’ll see these few lines:
if (typeof sIFR == “function" && !sIFR.UA.bIsIEMac)
{
sIFR.setup();
}
Don’t remove any of that code; you’ll have to insert some of your own code in order to
indicate which headings you want to replace and what you want to replace them with:
scripts/sifr.js (excerpt)
if (typeof sIFR == “function" && !sIFR.UA.bIsIEMac)
{
sIFR.setup();
sIFR.replaceElement(named({sSelector: “h1",
sFlashSrc: “flash/cooper_black.swf", sBgColor: “#FFFFFF",
sColor: “#0066CC", sWmode: “transparent"}));
}
sIFR.replaceElement specifies a replacement rule that you want sIFR to apply. You can have
as many of these as you like, each effecting a different type of element. The function takes a
number of arguments that effect the display of the Flash replacement.
There are a few of these arguments, but the named ones you’ll use most often .
You’ll notice that the heading is now shown twice. The upper display is the Flash
replacement, the lower is the HTML text. They’re both displayed simultaneously because
we haven’t yet included any of the special sIFR CSS.
No comments:
Post a Comment