我使用 photoswipe 插件:
(function(window, PhotoSwipe){
document.addEventListener('DOMContentLoaded', function() {
var options = {
preventHide: true,
getImageSource: function(obj) {
return obj.url;
},
getImageCaption: function(obj) {
return obj.caption;
}
},
instance = PhotoSwipe.attach([
{ url: 'http://www.site.com/img/8896/ico5.jpg', caption: 'Image 001' },
{ url: 'http://www.site.com/img/8897/ico5.jpg', caption: 'Image 002' },
{ url: 'http://www.site.com/img/8898/ico5.jpg', caption: 'Image 003' },
{ url: 'http://www.site.com/img/8899/ico5.jpg', caption: 'Image 004' },
{ url: 'http://www.site.com/img/9000/ico5.jpg', caption: 'Image 005' },
{ url: 'http://www.site.com/img/9001/ico5.jpg', caption: 'Image 006' }
], options);
instance.show(0);
}, false);
}(window, window.Code.PhotoSwipe));
我想从我页面中的一个简单网址启动画廊,如下所示:
<a href="#" id="photo">
<img src="/img/ico_photo1.png" border="0" /><br>
Gallery
</a>
但我不知道怎么做;你能帮助我吗?