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

How to make other links run #107

Open deliriouser opened 11 years ago

deliriouser commented 11 years ago

Hi all, i just build site here http://www.newlaunchvista.com/ I use MovingBoxes script on Hot Project Section. My question is, how to make the img and title clickable goes to the link provide For now the links click cause slide to the right or left except the center images.

Many Thanks

Mottie commented 11 years ago

It's not perfect, but try this code ([demo]())

$('#slider').movingBoxes({
    buildNav: true,
    navFormatter: function(index, panel){ return "●" },
    initialized: function(e, slider, tar){
        slider.$panels.find('a').bind('click', function(){
            window.location.href = $(this).attr('href');
        });
    }
});​

If that's not satisfactory, you can remove or comment out lines 60-65 of the jquery.movingBoxes.js file:

/* lines 60-65 -> remove these
base.$el.delegate('.mb-panel', 'click', function(e){
    if (!$(this).hasClass(o.currentPanel)) {
        e.preventDefault();  // prevent non-current panel links from working
        base.change( base.$panels.index($(this)) + base.adj, {}, true );
    }
});
*/

I'll probably need to add an option to make those links clickable, or not.