Search code examples
javascriptjquery-uijquery-ui-widget

Ryan Florence's rf.slideshow not working properly with JqueryUI 10 - is there a fix?


I have included the necessary files, then tried to run the slideshow. It seems to work visually, but:

var $x = $("#mydiv").slideshow();

returns undefined instead of the object that controls the show. When I use jqui 1.8, everything's fine. The problem seems to be the widget part, that is, jquery.ui.widget.js - so before I dive into fixing it, I'd like to ask 2 things:

  1. Has anyone encountered the same problem?
  2. Is there a fix?

Thanks, DK


Solution

  • I have just set up a jsfiddle and all seems to work with :

    • jquery-1.10.2
    • jquery.ui.core (from jquery-ui 1.10.4)
    • jquery.ui.widget.js (from jquery-ui 1.10.4)
    • jquery.rf.slideshow (latest release 1.1.1 from rpflorence repository)

    Open the jsfiddle, open your js console (F12), reload the page and you will see that the

    <div id="slideshow" class="slideshow">
    

    appears in the console (no undefined)

    EDIT:

    I don't know yet why the widget call without parameter doesn't return the instance itself. I'll try to investigate a little more on that point.

    But from jQueryUI 1.9 onwards, you can get the widget instance using .data() and the full widget name (including namespace), which is in your case:

    var $ss = $('#slideshow').slideshow().data('rf-slideshow');
    

    I edited the jsFiddle to reflect this.