Sometimes, We Write Stuff...

Mootools Content Slider Class v2

10 comments

Here's another update for my Mootools 'content slider class', along with several basic examples.  Sorry that it has taken so long to get this new version posted!

First of all, if you check out the class's code you'll notice that the use of 'bind' is gone.  I had always thought that was confusing stuff, even after I wrapped my head around it... and thanks to a little tip I read at David Walsh's site some time ago, I made use of declaring a 'self' variable instead.  (To all you Flash coders, this is similar to setting _lockRoot to true and then being able to use _root throughout externally loaded movies.)

Anyway, this content slider class works basically the same way as the old one – it's just easier to configure in multiple ways, and has a couple extra functionalities.  Here are the options available in this class:

slideTimer: 5000,  		//Time between slides (1 second = 1000), a.k.a. the interval duration
isPaused: false,		//flag for paused state
transitionTime: 1100, 		//Transition time (again, 1 second = 1000)
transitionType: 'cubic:out',	//Transition type
container: null,		//container element
items: null, 			//Array of elements for sliding
itemNum: 0,			//Current item number
numNavActive: false,		//Whether or not the number navigation will be used
numNavHolder: null,		//Element that holds the number navigation
playBtn: null,			//Play (and pause) button element
prevBtn: null,			//Previous button element
nextBtn: null			//Next button element

Again, everything is included in the demo files – so feel free to poke around and change things, etc.  And as always, I'm sure this code is far from perfect... so any and all criticisms/praises/etc. are welcome!  Note that I will read all comments, but unfortunately due to my crazy workload I will probably not have time to answer many questions.  (However, I may post a few 'advanced' examples on the demo page soon - including an alpha (fade in / fade out) version, a vertical version, a resizing version, etc.)

  • StumbleUpon It
  • del.icio.us

+ Comments

Here's a preview of your comment: