CSS-Tricks / MovingBoxes

Simple horizontal slider which grows up the current box when it's in focus (image, title & text) and back down when it's not in focus.
http://css-tricks.github.io/MovingBoxes/
GNU Lesser General Public License v3.0
280 stars 147 forks source link

Looping with a disabled left (rewind) arrow when you get back to the first image #105

Closed klgreene closed 11 years ago

klgreene commented 11 years ago

I'd like for the slider to have looping functionality while maintaining the disabled left side arrow (rewind functionality) when you get back to the first image in the slider order. How would I go about doing that? Right now when I change

wrap: true

It enables the arrows, so you can rewind to the last image in the slider even if you haven't scrolled all the way through in order.

Any help would be much appreciated!

Mottie commented 11 years ago

I think this is what you are describing (demo):

$('#slider').movingBoxes({

    // if true, the panel will "wrap" (it really rewinds/fast forwards) at the ends
    wrap: true,
    // if true, navigation links will be added
    buildNav: true,
    // function which returns the navigation text for each panel
    navFormatter: function(index, panel){ return "●" },

    // callback when MovingBoxes has completed initialization
    initialized: function(e, slider, tar){
        slider.$wrap.find('.mb-left')[ tar === 1 ? 'hide' : 'show' ]();
    },
    beforeAnimation : function(e, slider, tar) {
        slider.$wrap.find('.mb-left')[ tar === 1 ? 'hide' : 'show' ]();
    }

});​
klgreene commented 11 years ago

Yes, that is exactly it! Thank you VERY much.

Mottie commented 11 years ago

You're welcome :)