Cut & Paste Fade In Content Viewer
|
Description: This script
turns ordinary HTML content wrapped around DIV tags into a series of interactive
contents, with one faded into view on demand! You can use it to spotlight new or
important contents on your site. And since each content is simply normal HTML on
the page, setting it all up is painless. This is even true for the pagination
links, which are just regular links (A
elements) with special CSS
classnames (ie: "toc
") you define and style as desired. It's time
to show your visitors what you got on your site!
Note that this script uses the jQuery library.
Example:
Directions:
Step 1: Insert the below code to the HEAD section of your page:
The code above references two external .js files, including . Download them below:
Step 2: Add the below example HTML code to your page:
The HTML set up for Fade In Content Viewer is as follows:
<div id="whatsnew"
class="fadecontentwrapper">
<div class="fadecontent">
Content 1
</div>
<div class="fadecontent">
Content 2
</div>
<div class="fadecontent">
Content 3
</div>
</div>
<div id="whatnewstoggler"
class="fadecontenttoggler">
<a href="#" class="prev">Prev</a>
<a href="#" class="toc">Page 1</a> <a href="#" class="toc">Page 2</a> <a
href="#" class="toc">Page 3</a>
<a href="#" class="next">Next</a>
</div>
<script type="text/javascript">
//SYNTAX: fadecontentviewer.init("maincontainer_id", "content_classname",
"togglercontainer_id", selectedindex, fadespeed_miliseconds)
fadecontentviewer.init("whatsnew", "fadecontent",
"whatnewstoggler", 0, 400)
</script>
Observe the HTML structure for the Main content container, the individual contents' containers, and the pagination container. You call:
fadecontentviewer.init("whatsnew", "fadecontent", "whatnewstoggler", 0, 400)
At the end to initialize everything. The last two parameters let you set which content should be shown by default (0=1st content, 1=2nd etc), and the duration of the fade effect in milliseconds, respectively.
Customizing the Pagination links
The pagination links for the script are manually defined by you for maximum customization, with the use of CSS classnames to tell the script what each link should do:
<div id="whatnewstoggler"
class="fadecontenttoggler">
<a href="#" class="prev">Prev</a>
<a href="#" class="toc">Page 1</a> <a href="#"
class="toc">Page 2</a> <a href="#"
class="toc">Page 3</a>
<a href="#" class="next">Next</a>
</div>
Three different CSS class names can be used inside a link to give it special meaning:
-
class="prev":
This tells the script this link should be used to cycle backwards -
class="next":
This tells the script this link should be used to cycle forwards -
class="toc":
This tells the script this link should be one of the individual page links. You should define as many of these links as you have number of contents being shown.