specious / cloud9carousel

:cyclone: 3D-perspective carousel for jQuery / Zepto
http://j.mp/cloud9demo
233 stars 88 forks source link

go function #8

Closed ken-colvin closed 8 years ago

ken-colvin commented 8 years ago

Hi - can you please give an example of the go function

this.go = function( count ) {
     this.destRotation += (2 * Math.PI / this.items.length) * count;
    this.play();
    }

I am trying to implement it yet I can not get it to work. Thanks.

PS - Nice carousel. Gives a different state of the art presentation.

specious commented 8 years ago

It's described in the documentation as well as briefly in the source code:

//
// Spin the carousel.  Count is the number (+-) of carousel items to rotate
//
this.go = function( count ) {
  this.destRotation += (2 * Math.PI / this.items.length) * count;
  this.play();
}

Are you using $(<selector-to-select-your-carousel>).data("carousel") to access your instantiated carousel?

hqMoura commented 8 years ago

In addition, is there any way to jump to a specific image on the carousel? The go function only goes to a numeric value of slide changes, but If I want to go to a specific image, how do I do that?

specious commented 8 years ago

I suppose a convenience function to do that could be added, such as goTo( itemIndex ), but you should be able to do it quite easily in your application code as well.

hqMoura commented 8 years ago

Any tracks on how to do achieve that?

ken-colvin commented 8 years ago

My initial comment was about the same issue hqMoura is asking for. Basically, a "goTo" function. Can you please provide a sample piece of code, thanks.

specious commented 8 years ago

I don't have time, however if you ask on Stack Overflow somebody might provide a good answer to your question.