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

Anchor inside panel #102

Closed cormdog closed 12 years ago

cormdog commented 12 years ago

Is it possible add an anchor link inside one of the panels that would scroll to another panel. I want to create a couple questions that would then scroll to the appropriate panel. Thanks in advance.

Mottie commented 12 years ago

Hi @cormdog!

You can use the API to set the panel. Here's a demo and the code:

HTML (inside panel)

<a class="mb-link" href="#2">2</a>

Javascript (inside of a document ready function)

$('.mb-link').click(function(){
    // substring(1), removes the "#" from "#1"
    $('#slider').movingBoxes( this.hash.substring(1) );
});
cormdog commented 12 years ago

Awesome thanks