Y
Y
Yastr2018-06-13 12:18:20
JavaScript
Yastr, 2018-06-13 12:18:20

How to create a gallery in fancybox 3 using js?

Hello, please tell me how to make fancybox 3 treat a set of elements as a group.
The documentation says that you need to add data-fancybox="exmpl" to the link, but what if this is not possible? it is written about the select property, but when I add it, fb does not open at all.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tyzberd, 2018-06-13
@Yastr

var $links = $('.fancybox');
    
$links.on('click', function() {

    $.fancybox.open( $links, {
        // Custom options
    }, $links.index( this ) );

    return false;
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question