Search code examples
jqueryfancybox

Fancybox gallery from one image


I would like to make the gallery run as a slide show on its own, according to fancybox "autoPlay If set to true, slideshow will start after opening the first gallery item

Boolean; Default value: false"

Question is where does it need to be changed to true , or is there a script that needs to be put in with this?

$(document).ready(function() {
    $(".fancybox").fancybox();
});

All the examples on jsfiddle have HTML, JS and CSS code in the example. does the JS code go in with the above script like after the last ; before closing script tag?


Solution

  • From the docs

    You can pass these options as key/value object to fancybox() method

    meaning you can use this:

    $(document).ready(function() {
        $(".fancybox").fancybox({
           autoPlay: true,
           autoCenter: true // just to give another example
         });
    });