@ctmobile/ui-imageviewer-sd
Version:
支持移动端的UI组件-ImageViewer
80 lines (55 loc) • 1.97 kB
Markdown
* [Getting started](
* [Options](
* [API](
* [FAQ](
* [HTML in slides](
* [Responsive images](
* [Performance tips](
* [demo](
[请参考photoswipe的Getting started](http://photoswipe.com/documentation/getting-started.html)
[请参考photoswipe的Options](http://photoswipe.com/documentation/options.html)
[请参考photoswipe的API](http://photoswipe.com/documentation/api.html)
[请参考photoswipe的FAQ](http://photoswipe.com/documentation/faq.html)
[请参考photoswipe的HTML in slides](http://photoswipe.com/documentation/custom-html-in-slides.html)
[请参考photoswipe的Responsive images](http://photoswipe.com/documentation/responsive-images.html)
http://photoswipe.com/documentation/performance-tips.html
[请参考photoswipe的Performance tips](http://photoswipe.com/documentation/performance-tips.html)
```
import ImageViewer from '@ctmobile/ui-imageviewer';
// build items array
const items = [
{
src: 'http://pic37.nipic.com/20140110/17563091_221827492154_2.jpg',
w: 600,
h: 400
},
{
src: 'http://pic18.nipic.com/20120204/8339340_144203764154_2.jpg',
w: 1200,
h: 900
}
];
document.getElementById('photo1').addEventListener('click', () => {
const imageviewer = ImageViewer(document.getElementById('imageviewer'), items, {
index: 0
});
imageviewer.photoswipe.init();
});
document.getElementById('photo2').addEventListener('click', () => {
const imageviewer = ImageViewer(document.getElementById('imageviewer'), items, {
index: 1
});
imageviewer.photoswipe.init();
});
```