Created
March 9, 2016 20:13
-
-
Save newswim/e3c6c6de234c9c61d1c6 to your computer and use it in GitHub Desktop.
photoswipe setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var integrationGallery = function() { | |
var pswpElement = document.querySelectorAll('.pswp')[0]; | |
// build items array | |
var items = [ | |
{ | |
html: '<br><br><h1>This is a photoswiping plug-in</h1>' | |
}, | |
{ | |
src: 'https://farm7.staticflickr.com/6175/6176698785_7dee72237e_b.jpg', | |
w: 1024, | |
h: 683, | |
title: 'We can provide captions to the images here', | |
// msrc: 'string/path/to/thumbnail' // small image placeholder | |
} | |
]; | |
// define options (if needed) | |
var options = { | |
// history & focus options are disabled on CodePen | |
history: false, | |
focus: false, | |
showAnimationDuration: 0, | |
hideAnimationDuration: 0 | |
}; | |
var gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, items, options); | |
gallery.init(); | |
}; | |
document.getElementById('pswp_trig').onclick = integrationGallery; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment