情况
我正在使用instafeed插件根据主题标签从Instagram加载一些图像。跌势很好。每次单击Instagram图像时,我想在我的网站窗口中打开一个灯箱,其中包含图像,标题,用户名等。
var allTagFeed = new Instafeed({
target: 'instpop',
get: 'tagged',
tagName: 'mongolia',
clientId:'xxxxxxxxxxxx',
accessToken: 'xxxxxxxxxx',
limit:'2',
template: '<div id="caption">{{caption}} </div><div id="bg"><a href="{{link}}" target="_blank"><img src="{{image}}" /></a>{{likes}}</div>'
});
解决方案
创建一个调用该特定用户信息的函数,以便将其放入模板中。
问题
我不知道如何创建该功能。我还想问一问是否有人知道将Instagram图片及其信息(就像instagram.com一样)包含在单独的弹出窗口中,因为我不希望用户离开我的页面。
好的,我找到了一种方法:
单击此函数后,将采用模板中使用的类。
var allTagFeed = new Instafeed({
target: 'inst1all',
get: 'tagged',
tagName: 'mongolia',
clientId:'xxxxxxxxxxxxxxx',
accessToken: 'xxxxxxxxxxxxxx',
limit:'32',
template: ' <div class="cont" ><a href="{{link}}" target="_blank"><img src="{{image}}" /></a><div class="bg"><div class="likes"><img src="./img/likes.png">{{likes}}</div><div class="comments"><img src="./img/likes.png">{{comments}}</div></div><div class="caption">{{caption}}</div></div> '
});
$( document ).ready(function() {
//alert('s');
$("#inst1all").on('click','a', function(){
var _href = $(this).attr("href");
alert(_href);
});
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句