Javascript 使用Instafeed.js中的照片构建猫头鹰旋转木马

Javascript 使用Instafeed.js中的照片构建猫头鹰旋转木马,javascript,jquery,html,owl-carousel,instafeedjs,Javascript,Jquery,Html,Owl Carousel,Instafeedjs,我目前正在尝试构建一个图像旋转木马(使用Owl旋转木马),它可以动态地拉入Instagram照片(使用Instafeed.js)。我正在使用OWLCarouselV2和一些自定义脚本将图像分割成两行,就像网格一样。我还对Instafeed.js进行了适当设置,以便根据标签名导入图像 我在同步这两个插件时遇到了一些问题,因此我的猫头鹰转盘无法从Instafeed.js提要中提取图像 出于显示目的,我将carousel和Instagram提要分区分开,以便您可以看到它们都作为单独的插件工作(请注意,

我目前正在尝试构建一个图像旋转木马(使用Owl旋转木马),它可以动态地拉入Instagram照片(使用Instafeed.js)。我正在使用OWLCarouselV2和一些自定义脚本将图像分割成两行,就像网格一样。我还对Instafeed.js进行了适当设置,以便根据标签名导入图像

我在同步这两个插件时遇到了一些问题,因此我的猫头鹰转盘无法从Instafeed.js提要中提取图像

出于显示目的,我将carousel和Instagram提要分区分开,以便您可以看到它们都作为单独的插件工作(请注意,要显示Instagram图像,您必须输入自己的客户端id)

HTML:

这样照片就会被注入我的旋转木马?我注意到这样做只会破坏旋转木马:/

什么都行


小提琴:

在Instafeed加载图像后调用猫头鹰转盘

    var feed = new Instafeed({
    get: 'tagged',
    tagName: 'awesome',
    clientId: 'YOUR CLIENT ID',
    limit: 25,
    template: '<div class="item"><a href="{{link}}" target="_blank"><img src="{{image}}" alt="{{caption}}"/></a></div>',
    after: function () {
        for (var i = 0; i < 24; i++) {
            $newdiv = $('<div class="item"></div>').html('<img src="http://placehold.it/200x200">');
            $('#owl2row-plugin').append($newdiv);
        }
        var owl = $('#owl2row-plugin');
        owl.owlCarousel({
            loop: true,
            margin: 10,
            nav: true,
            dots: false,
            owl2row: 'true',
            owl2rowTarget: 'item',
            owl2rowContainer: 'owl2row-item',
            owl2rowDirection: 'utd',
            responsive: {
                0: {
                    items: 2
                },
                600: {
                    items: 3
                },
                1000: {
                    items: 5
                }
            }
        });
    }
});
feed.run();
var feed=new Instafeed({
得到:“标记”,
标记名:“真棒”,
clientId:“您的客户ID”,
限额:25,
模板:“”,
之后:函数(){
对于(变量i=0;i<24;i++){
$newdiv=$('').html('');
$('#owl2row plugin').append($newdiv);
}
var owl=$(“#owl2row插件”);
猫头鹰旋转木马({
循环:对,
差额:10,
导航:是的,
点:错,
owl2row:“真的”,
owl2rowTarget:'item',
owl2rowContainer:“owl2row项目”,
owl2rowDirection:'utd',
响应:{
0: {
项目:2
},
600: {
项目:3
},
1000: {
项目:5
}
}
});
}
});
feed.run();

HTML代码

<section class="instagram container-fluid mt-md ">
    <div class="row">
            <div id="owl2row-plugin" class="owl-carousels">
                 <div id="instafeed" class="owl2row-plugin">
                 </div>
            </div>
    </div>
</section>
    $(document).ready(function(){

        var feed = new Instafeed({

            //get: 'user',
            userId: 5411567,
            accessToken: '3722752.467ede5.edc5948480384f54915ea14617ce6716',
            get: 'user',
            //tagName: 'awesome',
            clientId: 'fdf210ab13ce47e48ac861bac822d1a3',
            limit: 25,


            after: function () {

                var owl = $('.owl2row-plugin');
                owl.owlCarousel({
                    loop: true,
                    margin: 0,
                    navText:['',''],
                    nav: true,
                    dots: false,
                    owl2row: 'true',
                    owl2rowTarget: 'item',
                    owl2rowContainer: 'owl2row-item',
                    owl2rowDirection: 'utd',
                    responsive: {
                        0: {
                            items: 3
                        },
                        600: {
                            items: 5
                        },
                        1000: {
                            items: 10
                        }
                    }
                });
            },
            template: '<div class="item"><a href="{{link}}" target="_blank"><span><img src="{{image}}" alt="{{caption}}"/></span></a></div>',

        });

        feed.run();

    });

jQuery代码

<section class="instagram container-fluid mt-md ">
    <div class="row">
            <div id="owl2row-plugin" class="owl-carousels">
                 <div id="instafeed" class="owl2row-plugin">
                 </div>
            </div>
    </div>
</section>
    $(document).ready(function(){

        var feed = new Instafeed({

            //get: 'user',
            userId: 5411567,
            accessToken: '3722752.467ede5.edc5948480384f54915ea14617ce6716',
            get: 'user',
            //tagName: 'awesome',
            clientId: 'fdf210ab13ce47e48ac861bac822d1a3',
            limit: 25,


            after: function () {

                var owl = $('.owl2row-plugin');
                owl.owlCarousel({
                    loop: true,
                    margin: 0,
                    navText:['',''],
                    nav: true,
                    dots: false,
                    owl2row: 'true',
                    owl2rowTarget: 'item',
                    owl2rowContainer: 'owl2row-item',
                    owl2rowDirection: 'utd',
                    responsive: {
                        0: {
                            items: 3
                        },
                        600: {
                            items: 5
                        },
                        1000: {
                            items: 10
                        }
                    }
                });
            },
            template: '<div class="item"><a href="{{link}}" target="_blank"><span><img src="{{image}}" alt="{{caption}}"/></span></a></div>',

        });

        feed.run();

    });
$(文档).ready(函数(){
var feed=新Instafeed({
//获取:“用户”,
用户ID:5411567,
accessToken:'3722752.467ede5.EDC594848038484F54915EA14617CE6716',
获取:“用户”,
//标记名:“真棒”,
客户ID:'fdf210ab13ce47e48ac861bac822d1a3',
限额:25,
之后:函数(){
var owl=$('.owl2row插件');
猫头鹰旋转木马({
循环:对,
保证金:0,
导航文本:['','',
导航:是的,
点:错,
owl2row:“真的”,
owl2rowTarget:'item',
owl2rowContainer:“owl2row项目”,
owl2rowDirection:'utd',
响应:{
0: {
项目:3
},
600: {
项目:5
},
1000: {
项目:10
}
}
});
},
模板:“”,
});
feed.run();
});
    $(document).ready(function(){

        var feed = new Instafeed({

            //get: 'user',
            userId: 5411567,
            accessToken: '3722752.467ede5.edc5948480384f54915ea14617ce6716',
            get: 'user',
            //tagName: 'awesome',
            clientId: 'fdf210ab13ce47e48ac861bac822d1a3',
            limit: 25,


            after: function () {

                var owl = $('.owl2row-plugin');
                owl.owlCarousel({
                    loop: true,
                    margin: 0,
                    navText:['',''],
                    nav: true,
                    dots: false,
                    owl2row: 'true',
                    owl2rowTarget: 'item',
                    owl2rowContainer: 'owl2row-item',
                    owl2rowDirection: 'utd',
                    responsive: {
                        0: {
                            items: 3
                        },
                        600: {
                            items: 5
                        },
                        1000: {
                            items: 10
                        }
                    }
                });
            },
            template: '<div class="item"><a href="{{link}}" target="_blank"><span><img src="{{image}}" alt="{{caption}}"/></span></a></div>',

        });

        feed.run();

    });