Question

I'm wondering whether there's an easy way to control an image slideshow that I have working with jQuery Cycle with a UI Slider widget.

Cycle code is:

$(window).load(function(){
    $('.foo').cycle({
        timeout : 80,
        speed : 80 ,
        startingSlide : 0,

    }); 

});

and the widget is as such:

$(function() {
  $( "#slider-vertical" ).slider({
    orientation: "vertical",
    range: "min",
    min: 0,
    max: 300,
    value: 300,
    slide: function( event, ui ) {
      $( "#amount" ).val( ui.value );
      console.log(ui.value);  
    }
  });
  $( "#amount" ).val( $( "#slider-vertical" ).slider( "value" ));
});

Any ideas on which Cycle options might be manipulated by the values that the ui widget is spitting out? Thank you!

Was it helpful?

Solution

Sorry, as usual I solved it right after posting.

jQuery Cycle code remains the same:

$(window).load(function(){
    $('.foo').cycle({
        timeout : 80,
        speed : 80 ,
        startingSlide : 0,
    }); 
});

And I changed the UI widget code (see the last line) as such, where I simply pass the widget value into Cycle. That value essentially sets the active slide.

$(function() {
  $( "#slider-vertical" ).slider({
    orientation: "vertical",
    range: "min",
    min: 0,
    max: 300,
    value: 300,
    slide: function( event, ui ) {
      $(".foo").cycle(ui.value); 
    }
  });      
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top