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

make only selected slide link clicable #36

Closed eXXon48 closed 13 years ago

eXXon48 commented 13 years ago

all that I need to do its make links in the slides unclicable until the slide became selected i try something like this

$("#slider li").not(".current").find("a").live("click",function(event){event.preventDefault();});

but this don't work

also i find out that when i clear cashe slider stops on first slide and buttons don't work, but when i click on left or right slide it sliding out as usual

Mottie commented 13 years ago

Try this (demo):

$("#slider a").bind("click",function(event){
    if ($(this).closest('.mb-panel').is('.current')) {
        // allow click
        return;
    } else {
        // prevent link from working - click still switches panels.
        event.preventDefault();
    }
});
eXXon48 commented 13 years ago

about buttons all works fine, just update jquery to latest version also updated moving boxes to latest

but still cant prevent click function on links that not in current page (slide)

eXXon48 commented 13 years ago

Thank you very much for your quick response, now it works as it should

also, if you using ajax load content into moving boxes its better to chose live() instead bind() $("#slider a").live("click",function(event){ .............. });

Mottie commented 12 years ago

Update: This should no longer be an issue in version 2.2.3+.