JQuery Random Div Display

From Web Developer Network Wiki
Jump to: navigation, search

Although there is still an older randompromo script built into the templates, some users may wish to load up slightly more complex content regions at random on page load.

This function makes it easy to load anything you can put inside a div tag, including multiple paragraphs of text and photos. It works especially well for story leads or student/faculty/staff features.


<div class="wdn_randomizer">
    <div>Content 1</div>
    <div>Content 2</div>
    <div>Content 3</div>
    <div>Content 4</div>
</div>
<script type="text/javascript">
WDN.initializePlugin('randomizer');
</script>

For accessibility reasons, if you are using this plugin for information that is something other than promotional, that same information must be located on another page on your site. See also: UNL QA Process in the UNL Style Guide

Because this script gives you the ability to load up more complex information, though, a best practice is to keep each of the div areas filled with roughly the same amount of content, otherwise your page may display drastically different to users, depending on which div content region is loaded.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox