Skip to content

Commit

Permalink
Changed so gallery is loaded after page is loaded (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
dekode-rasmus authored and Petter Walbø Johnsgård committed Apr 30, 2019
1 parent 90816f0 commit 482c7ca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion assets/js/hogan-gallery-slider.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 10 additions & 7 deletions src/slider/slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ const {
/**
* Hogan slider
*/
const sliders = document.querySelectorAll( '.hogan-gallery-carousel' );
window.onload = () => {
const sliders = document.querySelectorAll('.hogan-gallery-carousel');

Array.prototype.slice.call( sliders ).forEach( slider => {
new Flickity( slider, hoganGallery.flickityConfig ); // eslint-disable-line no-new
Array.prototype.slice.call(sliders).forEach(slider => {
new Flickity(slider, hoganGallery.flickityConfig); // eslint-disable-line no-new

if (slider.hasAttribute('data-pswp-uid')) {
new window.hogan.PhotoSwipe(slider, hoganGallery.photoswipeConfig); // eslint-disable-line no-new
}
});
}

if ( slider.hasAttribute( 'data-pswp-uid' ) ) {
new window.hogan.PhotoSwipe( slider, hoganGallery.photoswipeConfig ); // eslint-disable-line no-new
}
} );

0 comments on commit 482c7ca

Please sign in to comment.