(5)

mooHorizonSlider

this little slider class is build with the mootools framework 1.11. You can define various things:

* single image movement left / right
* multiple movement left / right
* scroll speed
* image container
* image size

In conjunction with the needed CSS style for the scroller, it creates an easy to use image slider. The slider class can be adjusted to fit your needs perfectly – imageWidth, imageCount, scrollRanges etc.

Check out the source of this page to see how it is implemented. You can also use this line of code, adjust it to your needs, copy the CSS to your file and get it going:

var p = new avScroll({container:’innerScroller’, imgWidth:233, scrollRange:24, leftHandle:’leftClicker’,rightHandle:’rightScroller’, rw:’leftFF’, ff:’rightFF’, speed:700});

Check it out here: moo horizontal slider

Filed under: AJAX, Design & Graphics, Programming, mootools — Tags: , , , , , — admin @ 11:34 am
 

5 Comments »

  1. Comment by Eric J

    May 21, 2008

    Is there an easy implementation to make this class stop at both ends, when it reaches the ends. Both with the single and multiple movement?

    Well of course you could add a check where in the row the slider is positioned, and check whether a right/left scroll would scroll out over the end. On the left side handle for a single click this is already implemented, the right side should be done this way:

    if(leftClicks + 4 > scrollRange){
    stepsLeft = (scrollRange - leftClicks)*imgWidth; // size to scroll right
    start= this.leftClicks * this.imgWidth;
    $(this.container).effect('right',{ duration: this.speed, wait:true, transition: Fx.Transitions.Back.easeIn }).start(start,stepsLeft);

    Guess this should work out, you only need to add this for the single click event and for the multiple click, just adjust the “4″ to the value you have been using for the scrollRange.

  2. Comment by maco

    June 24, 2008

    pls how to exactly use this script from the comment to stop on the right side. because its not working.

  3. Comment by admin

    June 24, 2008

    Actually I am too busy, but if you have some time and be patient, I’ll come up with a solution and post it here.

  4. Comment by maco

    June 24, 2008

    Thanks I’ll be waitting. It’s very nice script, only this bug ..

  5. Comment by Shashank

    June 28, 2008

    This works. Its not the most optimized but works well. All the 4 : the left, right, fast forward and rewind work.

    leftClick: function(){

    if(this.leftClicks > 0){
    var start= this.leftClicks * this.imgWidth;
    var end = ( this.leftClicks – 1 ) * this.imgWidth;
    $(this.container).effect(‘right’,{ duration: this.speed, wait:true, transition:Fx.Transitions.Back.easeIn }).start(start,end);
    this.leftClicks–;
    }

    },

    rightClick: function(){

    var start= this.leftClicks * this.imgWidth;
    var end = (this.leftClicks * this.imgWidth) + this.imgWidth;
    if(end < this.scrollRange) {

    $(this.container).effect(‘right’,{ duration: this.speed, wait:true, transition: Fx.Transitions.Back.easeIn }).start(start,end);
    this.leftClicks++;
    }
    },

    fastForward: function(){
    // scroll 4 images to the right, calculate it on base of the clicks and the image width
    var start= (this.leftClicks) * this.imgWidth;
    var end = (( this.leftClicks + 4 ) * this.imgWidth);
    if(end 0){
    var start= (this.leftClicks * this.imgWidth );
    if(this.leftClicks < 4){
    this.leftClicks = 4;
    }
    var end = ((this.leftClicks – 4 ) * this.imgWidth);
    $(this.container).effect(‘right’,{ duration: this.speed, wait:true, transition: Fx.Transitions.Back.easeIn }).start(start,end);
    this.leftClicks-= 4;
    }
    }

RSS feed for comments on this post. TrackBack URL

Leave a comment

copyright © 2010 artViper designstudio, all rights reserved

Latest twitter news

TweetMeme | Sun Feb 28

RT @nettuts Top 20+ MySQL Best Practices - Nettuts+ http://bit.ly/6C4FqG

TweetMeme | Wed Feb 24

RT @mashable Typekit Launches its Cloud-Based Web Font Service http://bit.ly/4w68Ub

TweetMeme | Wed Feb 24

RT @tweetmeme 3 New Ways to Measure the Social Web http://ow.ly/1o0cfQ

Random posts

09-09-29 | bumpbox fire on page load ...

Update 25 Jan 2010: Final bugfix - images now always show correctly inside the bumpbox. Added a preloader that works ...

07-04-05 | Tibco Ships Ajax Testing Tool (InformationWe ...

Tibco Ships Ajax Testing Tool (InformationWeek) The middleware is designed for message transport systems, such as IBM's...

09-09-21 | Website Thumbnails now captured with IE8 ...

After the update today, our screenshot | website thumbnail service now uses the new rendering engine of IE8. Although IE...