[英]Instafeed - Make images open in new window
我已經建立了一家商店來銷售產品,並且我想在自己的網站上添加Instagram feed。
我決定使用已安裝,並且所有功能都可以正常工作,只是我希望圖像在新窗口中打開。
我在這里查看了一些問題,並嘗試了模板。 模板停止顯示任何圖像,但是調試中也沒有看到錯誤。
這就是我所擁有的:
<script type="text/javascript">
var feed = new Instafeed({
get: 'user',
userId: 'my-user-id-here',
accessToken: 'my-access-token-here',
template: '<a href="{{link}}" target="_blank"><img src="{{image}}" /></a>',
limit:8
});
feed.run();
</script>
我有點難過。 有任何想法嗎?
最好的方法是使用template
選項:
var feed = new Instafeed({
template: '<a href="{{link}}" target="_blank"><img src="{{image}}" /></a>'
// other settings...
});
要么
在您的instafeed.js文件中,環顧第177行並添加anchor.setAttribute('target','_blank'); 工作精美。
或者您也可以添加popUp:
單擊后,函數將采用模板中使用的類。
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);
});
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.