Dynamic Slider Script
by Michael Smotherman
2/1/09 - Version 1.1 is being uploaded. You may notice page updates during this process.
1/26/09 - Version 1.0 up

What is DSS?

Dynamic Slider Script (DSS for short), is a lightweight (4kb) customizable addon for the MooTools library, created with designers in mind.

This script will slide between blocks of content, contained within a div that becomes the 'viewport'. It is designed to handle any number of items, any number of rows or columns, can go vertical or horizontal, can contain most content types, and is largely customizable.

Since the design and contents are up to you, it is also possible to combine this script with other utilities based on MooTools 1.2.x

Examples

  • Murals
  • Murals
  • Murals
  • Murals
  • Murals
  • Murals
  • Murals
  • Murals
  • Murals
  • Murals
  • Murals
  • Murals
  • Murals
  • Murals
  • Murals
  • Murals
  • Murals
  • Murals
  • Murals
  • Murals
  • Murals
 
  • Run Time: 1 hr. 26 min.
    Rating: PG-13
    Genre: Comedy
  • Run Time: 1 hr. 30 min.
    Rating: PG
    Genre: Family
  • Run Time: 1 hr. 20 min.
    Rating: PG
    Genre: Family
  • Run Time: 1 hr. 36 min.
    Rating: PG-13
    Genre: Romance
  • Run Time: 1 hr. 48 min.
    Rating: PG
    Genre: Comedy
  • Run Time: 1 hr. 39 min.
    Rating: PG-13
    Genre: Comedy
  • Run Time: 2 hr. 4 min.
    Rating: R
    Genre: Suspense
  • Run Time: 1 hr. 57 min.
    Rating: R
    Genre: Adventure
  • Run Time: 1 hr. 50 min.
    Rating: PG-13
    Genre: Suspense
  • Run Time: 1 hr. 30 min.
    Rating: R
    Genre: Horror
  • Run Time: 1 hr. 30 min.
    Rating: PG-13
    Genre: Horror
  • Run Time: 1 hr. 35 min.
    Rating: PG
    Genre: Adventure
 

Downloads

You will need the MooTools 1.2.x library, including the FX extension. If you already have this, awesome. Otherwise, a full version is included in our download. You can also visit MooTools' website for a more customized file (www.mootools.net)

The zip below contains all the files you will need for DSS. "dssConfig.js" contains all customizable information, "dss.js" is the core script, plus "mootools.js" the library. It is recommended to keep all your js files in a subdirectory (such as the one provided).

2/2/09 - Dynamic Slider Script v1.1 (.zip)

How To Use

Step 1.

Extract the files above to your web server and insert the following script tags into the head of your web document. Make sure to correct the paths to wherever your files are located. The scripts must be loaded in this order!

<head>
     <script type="text/javascript" src="js/mootools.js"></script>
     <script type="text/javascript" src="js/dssConfig.js"></script>
     <script type="text/javascript" src="js/dss.js"></script>
</head>

Step 2.

Create the following blocks of html where you want the scroller to be. Create a unique id name for identifying this slider block. The "dssWrap" class name must stay the same.

<div id="unique_id">
     <div class="dssWrap">
     </div>
</div>

The "dssWrap" div constrains the viewable slider area with a fixed width and height, so you will need to define values for these dimensions. Only the sliding content will go in this div, any other html for design or functionality should go outside of "dssWrap".

Step 3.

Now put in your content elements! We'll be using unordered list elements to wrap each content item. As of version 1.1, it must be a <ul> wrapper.

<div id="unique_id">
     <div class="dssWrap">
          <ul>
               <li> content 1 </li>
               <li> content 2 </li>
               <li> content 3 </li>
          </ul>
     </div>
</div>

Although not yet fully tested, any content you place inside the li elements should work. If you find any content types that do not work in v1.1, please leave some feedback!

Step 4.

Now we'll add the NEXT and PREV buttons/links. All you need to do is apply the class names "dssPrev" and "dssNext" to two different elements (such as <a> tags).

Make sure these elements are outside of the "dssWrap" div, but they must be contained inside the "unique_id" wrapper for unique targetting.

<div id="unique_id">
     <a class="dssPrev" href="#">Previous</a>
     <div class="dssWrap">
          <ul>
               <li> content 1 </li>
               <li> content 2 </li>
               <li> content 3 </li>
          </ul>
     </div>
     <a class="dssNext" href="#">Next</a>
</div>

Step 5.

Edit the "dssConfig.js" file in your favorite app. This file contains all the settings to control the scrolling viewspace. Below is an example...

dssConfig = {
     "unique_id":
     {
          direction:"vertical",
          width:240,
          height:120,
          items:8,
          continuous:"on",
          slidespeed:900,
          slidemode:"bounce",
          rollover:"on",
          rollopacity:35,
          rollspeed:400
     },
}

Configuration Info

PropertyValueDefaultRequired
"unique_id": Replace "id_name" with your unique id for the parent divnoneYes
direction:"vertical" or "horizontal""vertical"Yes
width:This is the width of the viewspace (div id "dssWrap")noneYes
height:This is the height of the viewspace (div id "dssWrap")noneYes
items:How many items are viewable per scroll?noneYes
continuous:"on" or "off" , first and last pages will cycle back and forth"off"No
slidespeed:milliseconds (1000 = 1 second)900No
slidemode:Transition effect: "cubic", "quart", "circ", "sine", "bounce", or "elastic""quart"No
rollover:"on" or "off" to enable the opacity rollover effect"off"No
rollopacity:0 to 100 for percent of opacity state70No
rollspeed:milliseconds (1000 = 1 second)400No

NOTE:  Items that are indicated as not required can be excluded from dssConfig.js and will use the default values.

Step 6 (optional).

To make more than 1 sliding content box, just repeat the above steps! Make sure to use new unique id names for each new box. Below is an example of the "dssConfig.js" file using 2 dss boxes on the same page...

Also notice I chose to allow defaults for some of the optional parameters by simply excluding them.

dssConfig = {
     "unique_id":
     {
          direction:"vertical",
          width:240,
          height:120,
          items:8,
          continuous:"on",
          slidespeed:900,
          slidemode:"bounce",
          rollover:"on",
          rollopacity:35,
          rollspeed:400
     },
     "unique_id_2":
     {
          direction:"horizontal",
          width:480,
          height:120,
          items:4,
          slidespeed:900,
          rollover:"on",
          rollopacity:35,
     },
}

Enjoy!

Stay tuned for an even better version, hopefully soon.
Also coming soon, jQuery version.

Current Version Notes: v1.1

  • Added "continuous" mode
  • Config options added for slidespeed, slidemode, and rollspeed
  • Utilizes ul and li for cleaner html
  • Plenty of room for creative css design

Future Version Ideas: v1.2

  • Pagination
  • Automatic cycle

Donate

If you feel generous, any donations are greatly appreciated. DSS is provided completely free, and all future versions will remain free as well. Thanks!

Feedback

Comment Script
Very nice script. A jquery version would be awesome. One suggestion: maybe you could add an offset-option, so that it's possible to define the first visible item (like no. 5 of 10).

Thanks a lot!
#1 - Christopher - 03/11/2009 - 05:11
Hi, excelent script! Sadly I cant make it work in IE 7 and that's strange since your examples works in that browser. FF 3 and Chrome works too.

I tryed creating an example webpage just to test it following your examples, this is the code I used:

Thank you!
#0 - Pepe - 03/03/2009 - 19:37
Name
E-mail (Will not appear online)
Comment
;-) :-) :-D :-( :-o >-( B-) :oops: :-[] :-P
To prevent automated Bots form spamming, please enter the text you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.



This comment form is powered by GentleSource Comment Script. It can be included in PHP or HTML files and allows visitors to leave comments on the website.