jquery - how to goto 2 slides -
i have 3 "main" slides. there "intermediate" slide in between each of "main" slides , hoping can achieve following effect click on appropriate buttons
("go slide 1", "go slide 2","go slide 3")
when user click button1 ("go slide 1")
1) $('.cycle-slideshow').cycle('goto', intermediate slide);
2) perform task (i need intermediate slide image create zoom in effect)
2) $('.cycle-slideshow').cycle('goto', 1);
ans on...
thank in advance help.
maybe try this. haven't tested it. want use advanced cycle2 api write own goto (jump) handler, per page: http://jquery.malsup.com/cycle2/api/advanced.php.
here's default jump function (search jump: function): https://github.com/malsup/cycle2/blob/45fde557e8fb4c2d59a9667ba744b63a0da9916c/build/jquery.cycle2.js
so here's modified version of function (again not tested!):
$('.cycle-slideshow').on('cycle-bootstrap', function (e, optionhash, api) { // replace "jump (goto)" method custom implementation. // next part same original api.jump = function (index, fx) { var fwd; var opts = this.opts(); if (opts.busy && !opts.manualtrump) return; var num = parseint(index, 10); if (isnan(num) || num < 0 || num >= opts.slides.length) { opts.api.log('goto: invalid slide index: ' + num); return; } if (num == opts.currslide) { opts.api.log('goto: skipping, on slide', num); return; } // put remaining code in function can call twice function jump_inner(num) { opts.nextslide = num; cleartimeout(opts.timeoutid); opts.timeoutid = 0; opts.api.log('goto: ', num, ' (zero-index)'); fwd = opts.currslide < opts.nextslide; opts._tempfx = fx; opts.api.preparetx(true, fwd); } // figure out intermediate slide. i'm guessing on how want this. change logic whatever need, or maybe intermediate slide same each button. var intermediate; switch (num) { case '1': intermediate = 4; break; case '2': intermediate = 5; break; case '3': intermediate = 6; break; } // first intermediate. jump_inner(intermediate); // use settimeout wait time next slide settimeout("jump_inner(num);", 2000); } });
Comments
Post a Comment