I'm using the slideshow cycle.all.js jquery plugin for my drupal website.(http://jquery.malsup.com/cycle/) I'm trying to skip the first slide after it loops once. Not sure how to do this, can someone give me hint or a solution?
Thanks
I'm using the slideshow cycle.all.js jquery plugin for my drupal website.(http://jquery.malsup.com/cycle/) I'm trying to skip the first slide after it loops once. Not sure how to do this, can someone give me hint or a solution?
Thanks
working on this, too -- used the following code to success
$('.slider').cycle({
after: onAfter;
});
function onAfter(curr,next,opts) {
//if next slide is 0, then it's the first slide. switch to "1", second slide
if(opts.nextSlide == 0 ) {opts.nextSlide = 1};
}
In the plugin you have the option startingSlide
which is the index of the slide on which to start (0 being the first one). So after displaying the first slide, you can try to change this option to 1
to skip the first one on next cycle.
Something like this might work:
$('#mydiv').cycle({
after: function(currSlideElement, nextSlideElement, options, forwardFlag) {
$(this).cycle({startingSlide: 1});
}
});
I know this may not be the nicest way, but it seems to work.
$(document).ready(function() {
//Call the slider so that the images overlap
$('.slideshow').cycle({
timeout: 800,
speed: 200
});
//Display the first slide for 1000ms
setTimeout(function(){
//Remove first slide
$('.slideshow img:first').remove();
//Reinit the cycle
$('.slideshow').cycle('destroy').cycle({
timeout: 800,
speed: 200
});
}, 1000);
});
$(window).ready(function() {
$('#slideshow').cycle({
fx: 'fade',
startingSlide: 0,
random: 1,
speed: '200',
timeout:'2000',
delay: 5000,
next: '#next',
prev: '#prev',
slideResize: true,
containerResize: false,
width: '100%',
fit: '1',
cleartypeNoBg: 'true',
cleartype: 'true',
after: onAfter
});
function onAfter(curr,next,opts) {
if(opts.nextSlide == 0 ) {opts.nextSlide = 1};
}
});
$(document.documentElement).keyup(function (e) {
if (e.keyCode == 39)
{
$('#slideshow').cycle('next');
}
if (e.keyCode == 37)
{
$('#slideshow').cycle('prev');
}
});
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
It's possible to do so also from admin through slider API (but 1st slide might blink for a second:( ):
var ended = false;
revapi1.bind("revolution.slide.onchange",function (e,data) {
var totalSlides = revapi1.revmaxslide();
if (data.slideIndex === totalSlides) {
ended = true;
}
});
revapi1.bind("revolution.slide.onbeforeswap",function (e, data) {
if (ended && data.nextslide.index() === 0) {
console.log("Slider: skip first slide after loop")
revapi1.revshowslide(2);
ended = false;
}
});