Skip to content

Instantly share code, notes, and snippets.

@newswim
Created March 9, 2016 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save newswim/e3c6c6de234c9c61d1c6 to your computer and use it in GitHub Desktop.
Save newswim/e3c6c6de234c9c61d1c6 to your computer and use it in GitHub Desktop.
photoswipe setup
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