Javascript Lightbox-下一个和上一个按钮

Javascript Lightbox-下一个和上一个按钮,javascript,jquery,css,lightbox,Javascript,Jquery,Css,Lightbox,所以我使用这个灯箱,我需要把下一个和上一个按钮,但我不知道如何。如果有人能帮我 $(document).ready(function () { $('.lightbox').click(function () { // Get all following .box and .background until next .lightbox is met. // So we can get the related contents.

所以我使用这个灯箱,我需要把下一个和上一个按钮,但我不知道如何。如果有人能帮我

 $(document).ready(function () {
        $('.lightbox').click(function () {
          // Get all following .box and .background until next .lightbox is met.
          // So we can get the related contents.
          var $targets = $(this).nextUntil('.lightbox', '.box, .background');
            $targets.animate({
                'opacity': '.50'
            }, 500, 'linear')

            $targets.filter('.box').animate({
                'opacity': '1.00'
            }, 500, 'linear');

            $targets.css('display', 'block');
        });

        $('.close').click(function () {
            $('.background, .box').animate({
                'opacity': '0'
            }, 500, 'linear', function () {
                $('.background, .box').css('display', 'none');
            });;
        });

        $('.background').click(function () {
            $('.background, .box').animate({
                'opacity': '0'
            }, 500, 'linear', function () {
                $('.background, .box').css('display', 'none');
            });;
        });
    });

这里>

我认为您可以使用已经创建的插件,这将允许您只需在几分钟内自定义它,然后“砰”的一声使用它:)如“iLightBox插件”或“AndreKnierim.de/simple lightbox/”。如果您想编写自己的lightbox,那么问题就更深入了,然后只需添加两个按钮next和prev,您将为此花费大量时间来创建良好的结构化代码&很好地标记它并测试它。关于如何编写自己的lightbox有很多课程,你应该自己选择它,因为它们有不同的难度。Tks的提示@Maksymsulym我认为你可以使用已经创建的插件,这将允许你在几分钟内自定义它并“轰”使用它:)比如“iLightBox插件”或“Andrewineriem.de/simple-lightbox/“。如果您想编写自己的lightbox,那么问题会更深入,然后只需添加两个按钮next和prev,您将为此花费大量时间来创建良好的结构化代码&很好地标记它并测试它。关于如何编写自己的lightbox,有很多课程,你应该自己选择,因为它们有不同的难度