简体   繁体   中英

fancybox disable button on last gallery image

I am using fancybox to display a gallery of pictures. But I wanted to put an interactive puzzle on the last slide. The puzzle works, but when I try to select some of the puzzle pieces on the right or left, the nav buttons appear and overlap the puzzle, causing me to either go to the previous slide or loops me back to the beginning.

Question is: How can I have an image gallery with navigation buttons function, until I get to the last slide? I want to disable the right/left arrow and its functionality on the last slide only.
Is this even possible?

        $(document).ready(function() {

    $(".grouped").fancybox({

        openEffect              : 'none',
        closeEffect             : 'none',
        prevEffect              : 'none',
        nextEffect              : 'none',
        closeBtn                : false,

        helpers : {
            title : {
                type : 'inside'
            }
        }
        });

}); 

My class for the gallery is

<a class="grouped" data-fancybox-group="button" href="../theme/images/questions_screen.jpg">

and the class for the puzzle is

<a class="grouped fancybox.iframe" data-fancybox-group="button" href="../theme/hidden_game/games">

you can track by index

$('.fancy-el').fancybox({
      afterLoad: function(current) {
           if (current.index === current.group.length - 1) {
               current.arrows = false;
           }
      }
 });

http://jsfiddle.net/x03xqu7t/3/

when you reach on the last frame, you can hide the previous and next with css

.fancybox-prev, .fancybox-next add display:none; to above classes when you reach last frame.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM