javascript - Hammer.js Carousel Start Pane -


heyho,

i´am working on project in university , i´d use "hammer.js". i´ve downloaded carousel-example , works me.

but start middle pane of code , it´s not simple think.

it´s this:

http://img203.imageshack.us/img203/6326/schemeas.jpg

so hammer.js starts green screen. start yellow one. i´ve added 1 swipe right init function looks horrible when page loading , not goal ^^

i hope of have idea how solve problem.

try calling

carousel.showpane(1); 

that display second pane instantly. want put near bottom, right after says.

carousel.init(); 

if you're feeling adventurous try , make automatically start pane there's variable inside carousel function called current_pane set default of 0 (the first pane). altering may work might require more code somewhere else. experiment!

edit

null right, animate it. here's more in depth method set without animation:

i found method responsible changing pane showing setcontaineroffset mthod passed variable animate it. told use showpane(2) called

setcontaineroffset(offset, true) 

which caused animation occur. should instead make different version of showpane...

this.setpane = function( index ) {          // between bounds         index = math.max(0, math.min(index, pane_count-1));         current_pane = index;          var offset = -((100/pane_count)*current_pane);         setcontaineroffset(offset, false);     }; 

you'll find it's identical showpane except name , fact calls setcontaineroffset animation: false. show pane of choice , can called using

carousel.setpane(index); 

what i've done added init function looks this:

 this.init = function() {         setpanedimensions();         var c = this;         $(window).on("load resize orientationchange", function() {             setpanedimensions();             c.setpane(current_pane);             //updateoffset();         })     }; 

now can change

var current_pane = 0; 

to whatever want , carousel start pane when it's initialised! simple!


Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -