
Home
Dynamic Content
Iframe and Ajax
Here
|
Categories
Partners
DaniWeb is an exciting community for web developers, Internet marketers, and technology enthusiasts.
Other Sections
Sweet Ads
Compatibility
|
|
NS6+ IE5+ Opera 8+
Interstitial Content Box (v1.1) Author:
Note: Updated to v1.1 on Nov 27th 06'. Added option to hide document scrollbars when interstitial box is shown, plus auto hide box after x seconds. Description: An interstitial is a container that appears over an entire webpage intermittently to display content in an eye catching way. A common example is an interstitial ad, though advertising is certainly just one of many handy uses of an interstitial. This is a Interstitial Box script that uses Ajax to fetch and display the contents of external pages on your server as an interstitial. As the content is being shown front and center on the page, a partially opaque "veil" appears behind it that covers the actual webpage, ensuring all eyes is on the interstitial. A robust frequency control system lets you control how often the interstitial box should appear so it doesn't become intrusive. Whether you're displaying an ad or an announcement, you can be sure people will notice it thanks to the Interstitial Box! Frequency control is an important part of a good interstitial script. This script supports three ways to control how often it should appear to the visitor:
Stellar! Demo: You should have seen it when entering page. Reload page to see it again (picks randomly from two external pages). Simply insert the below code into the HEAD section of your page: The code above references two external files plus two images, which you need to download below (right click/ select "Save As"):
In order to test out this script immediately, the external file(s) to display in the script must be defined (or an Ajax error will occur). Download the below two sample external pages used in the demo for testing purposes:
By default, all of the above files should be uploaded to the same directory as where your webpage is in. Well that's it for installation! Read on for instructions on configuration. Configuration HelpThe main settings for this script are done inside interstitial.js. Open the file using any text editor, and configure the first 5 variables: var interstitialBox={ Here's an explanation of each of these variables:
Having configured these variables, you'll now want to move on to interstitial.css to fine tune the look/style of the interstitial box. Most notably, customize the width of the box so it can adequately contain the external page(s) to show. External page limitations and the iframe tagAn inherent limitation of Ajax means that any external pages to be shown must be from the same domain as the script. You could, however, specify an iframe as the contents of an external page to display an external site that way. This is illustrated in "samplecontent2.htm". Enjoy!
|