Created
April 16, 2018 12:19
-
-
Save ivan-kalachikov/3bf8b88fa8c309b05043bf812d4ef5c0 to your computer and use it in GitHub Desktop.
magnific-popup-gallery-image-plus-video
This file contains hidden or 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
jQuery(document).ready(function($) { | |
$('.popup-gallery').magnificPopup({ | |
delegate: 'a', | |
type: 'image', | |
tLoading: 'Loading image #%curr%...', | |
mainClass: 'mfp-img-mobile', | |
gallery: { | |
enabled: true, | |
navigateByImgClick: true, | |
preload: [0,1] // Will preload 0 - before current, and 1 after the current image | |
}, | |
image: { | |
tError: '<a href="%url%">The image #%curr%</a> could not be loaded.', | |
/*titleSrc: function(item) { | |
return item.el.attr('title') + '<small>by Marsel Van Oosten</small>'; | |
}*/ | |
}, | |
callbacks: { | |
elementParse: function(item) { | |
// the class name | |
if(item.el.context.className == 'video-link') { | |
item.type = 'iframe'; | |
} else { | |
item.type = 'image'; | |
} | |
} | |
}, | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment