Sometimes, We Write Stuff...

Mootools Content Slider With Intervals

29 comments

Due to the amount of redundant questions about old versions of the content slider, I've deleted the old versions from my site (such as this one) to eliminate further confusion.

Please visit the latest version, located here: Latest Content Slider Version.

Promote This Article

  • StumbleUpon It
  • del.icio.us

+ Comments

#1
aavan said:
Jun 16, 2008 10:41
Hi, I'd like to know how to use this script but with controls like a next/previous and a play/pause buttons ?
#2
Daniel said:
Jun 16, 2008 02:31

Hi Aavan, that should be fairly easy to accomplish. I'll try to get an example of that up tonight or sometime tommorow, ok? (It's a crazy Monday over here, otherwise I'd do it this afternoon!)

#3
Daniel said:
Jun 17, 2008 02:43
Scratch that... I probably won't be able to get to it until the weekend. Sorry, it's insanely busy over here this week!
#4
Damien said:
Jun 17, 2008 10:21
i too would like to see some controls. this is a pretty nice content slider! good work!
#5
Tim said:
Jun 22, 2008 04:32
Awesome Tutorial! An option for controls would definitely polish this. Thanks!
#6
George said:
Jun 29, 2008 03:51
This with controls should be amazing!
#7
Daniel said:
Jun 30, 2008 03:34

Hi George, the updated version with controls is available in the next post. smile

#8
William said:
Jul 04, 2008 01:06

hi, it's a very nice scroller...do it only work with mootools 1.2 or can i use it with 1.11 as well? thanks

#9
nulll said:
Jul 27, 2008 06:34

ciao, i'm tring to put this script in a mootools class, but somehow is not working... the animation for incoming slide seems to work fine, i'm aving troubles with the outgoing one... can you help me? where i'm wrong? this is my class code


var Showcase = new Class({

//implements
Implements: [Options],

inFx: new Array(),
outFx: new Array(),
timer:null,

//options
options: {
slideTimer: 5000,  //time between slides (1 second = 1000), a.k.a. the interval duration
transitionTime: 1250, //transition time (1 second = 1000)
items: null,  //Get array of elements for sliding
itemNum: 0
},

//initialization
initialize: function(options) {
//set options
this.setOptions(options);

this.options.items.each(function(v, k){
  this.inFx[k] = new Fx.Morph(v, {
    duration: this.options.transitionTime,
    transition: Fx.Transitions.Quad.easeInOut,
    wait:false
  });  

  this.outFx[k] = new Fx.Morph(v, {
    duration: this.options.transitionTime,
    transition: Fx.Transitions.Quad.easeInOut,
    wait:false
  });        

 }, this);

},

//a method that does whatever you want
start: function() {

//call the function, periodically  (note: the interval period is defined at the top of this file)
this.timer = this.slideIt.periodical(this.options.slideTimer, this);
},


slideIt: function() {

var numItems = this.options.items.length;  //get number of slider items

var curItem = this.options.itemNum;

//change index
if(this.options.itemNum < (numItems - 1)){
  this.options.itemNum++;
}
else{
  this.options.itemNum = 0;
}

var newItem = this.options.itemNum;

//we will set a beginning value here
//this is so that it gives the illusion of continuous motion from one direction, even after the first cycle of items
this.inFx[curItem].start({
'left': [500, 0],
'opacity':[0,1]
});

//no beginning values needed, since we always want to push the old item out to the left
this.outFx[newItem].start({
'left': '-500',
'opacity':[0]
});

}

});

nulll said:
Jul 27, 2008 06:44

sorry...the wrong thing in my code is here:

this.inFx[curItem].start({ ‘left’: [500, 0], ‘opacity’:[0,1] });

this.outFx[newItem].start({ ‘left’: ‘-500’, ‘opacity’:[0] });

sould be:

this.inFx[newItem].start({ ‘left’: [500, 0], ‘opacity’:[0,1] });

this.outFx[curItem].start({ ‘left’: ‘-500’, ‘opacity’:[0] });

Daniel said:
Jul 28, 2008 03:45

Very nice job, Null! (I am just now reading both of your comments.)

First, glad you were able to solve the problem! Secondly, thanks for sharing your class – I know a lot of people will find it helpful! smile

(And I see that something weird happens when posting code in these comments... I'll get that fixed, sorry!)

mo said:
Jul 31, 2008 04:51

very nice script but how i can put buttons in it??

Jul 31, 2008 09:33

I would like to know how can I add a hyperlink to control the slide_item on mouse over exemple: after slide 1 enters then slide 2 how can I click in the hyperlink and come back to slide 1? Please I need that, thank you!

Daniel said:
Jul 31, 2008 12:13

@mo and Clavel: You might want to take a look at the more recent 'content slider' posts I've made here. This particular one is the most basic version...

nulll said:
Jul 31, 2008 06:24

ciao, i'm going on developping my version of your idea... but i'm a bit worried by using the absolute positioning

do you think it could be possible to have the same sliding effect without the absolute positioning, and for it, working on something else instead the left css property ?

Daniel said:
Jul 31, 2008 06:35

Hi Nulll,

I'm pretty sure you could do it with relative positioning as well, but you'll definitely need to use one or the other to perform a 'sliding' effect. I just like using absolute positioning inside of relatively positioned elements, as it gives me full control of placement with any browser/OS combination.

As for using the 'left' property, again - you'll probably need to use that to achieve any style of sliding effect. (You could use 'top' if you wanted a vertical slide...)

I suppose you could also do this type of effect with margins or padding, but I think you'd find issues with certain browsers.

Alfred said:
Aug 30, 2008 09:05

You made my dreams come true...........

Alfred said:
Aug 30, 2008 11:43

One question though.

When I load mine in IE, it showed 3 errors.

1) Link:284 Char:40 Error:'null is null or not an object. Code:0

2) Link:9 Char:2 Error:'null is null or not an object. Code:0

3) Link:4 Char:2 Error:'null is null or not an object. Code:0

And the error icon refused to go away on any page of my site.

Is it something serious?

Daniel said:
Aug 30, 2008 02:23

Hi Alfred,

What version of IE are you using? (I'm not seeing any errors when I view the demo in IE6 or IE7.)

Alfred said:
Aug 30, 2008 08:37

Or maybe it's my IE, can you see whether are there any erros on my site in your browser?

www.hungzai.com/home/

Brenen said:
Oct 12, 2008 06:53

Is it possible to have this sort of thing, but instead of sliding in new ones, it just fades out the old one? Basically what you have here, but without the sliding. How would I go about doing that, if it's possible?

FloiT said:
Jan 20, 2009 07:00

fff... no way to make it work out in a wordpress theme. Anybody knows why? I've checked everything thousand times...

Tim said:
Jan 20, 2009 08:05

Thanks a LOT for this script! It was just what I was looking for. I had to transfer a small application made with jQuery and the jCarouselLite-Plugin to MooTools, as it had to coexist with another MooTools application on the same website. With only small adaptions to your script, I was able to re-build the jQuery slide functions on MooTools smile

Wayne said:
Apr 02, 2009 09:50

Total Ah ha man, great stuff. I've been hunting for this very component, so thank you much!

Also, would love to grab your feed, but I want to grab it by email. Can you send me a link to get your feed by email? That would be terribly super. smile

Thanks for taking the time to write this post up!

Sabier said:
Apr 10, 2009 03:40

Howdy, This was a perfect slider to place it in my application, which will globally launched in about 5 months time. Thanks a lot!

gecko said:
Apr 29, 2009 08:37

There is a way to use the script with MooTools 1.11. Just edit the "interval_slide.js" at row #99 and #111. Change the the "Fx.Morph" to "Fx.Styles" and voila:)

gecko said:
Apr 29, 2009 08:38

great stuff, btw. Thanks!

Magnus said:
Jun 08, 2009 12:09

Hi Daniel, just wanted to say thanks for this. I was able to get it running in 2 mins. Saved my day and a lot of work! Thanks

Spyro said:
Jun 25, 2009 05:03

How to Morph with fade transition?

Here's a preview of your comment:

Discuss This Post:

You guessed it... your name goes here.

Have a website? Put it here.

We promise, we won't share your address with ANYONE.


Type your comment here... this box will auto expand!

Note: URLs will be auto-converted to links!

Please enter the word you see in the image.



* - denotes required fields