我正在尝试为我的个人网站制作画廊。问题是画廊没有出现在轮播中,而是像网格画廊一样显示。我已遵循官方设置指南中的所有内容。当我检查页面时,我会在控制台中看到类似这样的内容:
blueimp Gallery: No or empty list provided as first argument. HTMLCollection[18]
画廊代码:
<div id="blueimp-gallery-carousel" class="blueimp-gallery blueimp-gallery-carousel">
<div class="slides"></div>
<h3 class="title"></h3>
<a class="prev">‹</a>
<a class="next">›</a>
<a class="play-pause"></a>
<ol class="indicator"></ol>
</div>
<div id="instafeed"></div>
<script type="text/javascript">
var feed = new Instafeed({
get: 'user',
userId: '',
accessToken: '',
clientId: '',
template: {% raw %}'<a href = {{image}} ><img src = "{{image}}"></a>'{% endraw %},
sortBy: 'most-recent',
limit: 18,
links: false
});
feed.run();
</script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="js/jquery.blueimp-gallery.min.js"></script>
<script>
blueimp.Gallery(
document.getElementById('instafeed').getElementsByTagName('a'),
{
container: '#blueimp-gallery-carousel',
carousel: true
}
);
</script>
使用 {% raw %} 是因为该站点是用 jekyll 制作的。我在这里读到了。图片库可以在我的个人网站底部找到。
更新代码:
<div id="blueimp-gallery-carousel" class="blueimp-gallery blueimp-gallery-carousel">
<div class="slides"></div>
<h3 class="title"></h3>
<a class="prev">‹</a>
<a class="next">›</a>
<a class="play-pause"></a>
<ol class="indicator"></ol>
</div>
<div id = "instafeed">
</div>
<script type="text/javascript">
var feed = new Instafeed({
get: 'user',
userId: '270912755',
resolution: 'standard_resolution',
accessToken: '270912755.4e019ce.38f9a6730d14410b919b96cc3ee658dd',
clientId: '4e019ce8ec2744dca631db3ddf85607d',
template: {% raw %}'<a href = "{{image}}" ><img src = "{{image}}"></a>'{% endraw %},
sortBy: 'most-recent',
limit: 18,
links: false,
mock: true,
success: function(response) {
blueimp.Gallery(
document.getElementById('instafeed').getElementsByTagName('a'),
{ container: '#blueimp-gallery-carousel',
carousel: true
}
);
}
});
feed.run();
</script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="js/jquery.blueimp-gallery.min.js"></script>