Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function popup_masonry_gallery() {
- ?>
- <script type="text/javascript">
- (function($){
- $(window).load(function(){
- $('.av-masonry a.av-masonry-entry.lightbox-added').magnificPopup({
- type: 'image',
- image: {
- titleSrc: false,
- markup: '<div class="mfp-figure">'+
- '<div class="mfp-close"></div>'+
- '<div class="mfp-top-bar">'+
- '<div class="mfp-title"></div>'+
- '</div>'+
- '<div class="mfp-img"></div>'+
- '<div class="mfp-bottom-bar">'+
- '<div class="mfp-description">'+
- '<div class="mfp-alt"></div>'+
- '<div class="mfp-caption"></div>'+
- '</div>'+
- '<div class="mfp-counter"></div>'+
- '</div>'+
- '</div>',
- },
- mainClass: 'avia-popup mfp-zoom-in mfp-image-loaded',
- closeOnContentClick: false,
- midClick: true,
- gallery: {
- enabled: true
- },
- callbacks: {
- markupParse: function (template, values, item) {
- values.title = item.el.attr('title') !== "" ? '<h2>' + item.el.attr('title') + '</h2>' : '';
- },
- change: function() {
- var AltItem = $(this.currItem.el).find('img').attr('alt') !== "" ? $(this.currItem.el).find('img').attr('alt') : '';
- var CaptionItem = $(this.currItem.el).find('.av-masonry-entry-content').length > 0 ? $(this.currItem.el).find('.av-masonry-entry-content').html() : '';
- $(this.content).find('.mfp-alt').html(AltItem);
- $(this.content).find('.mfp-caption').html(CaptionItem);
- },
- /*** if you like to have the arrows inside the container
- buildControls: function() {
- // re-appends controls inside the main container
- this.arrowLeft.appendTo(this.contentContainer);
- this.arrowRight.appendTo(this.contentContainer);
- },
- *** remove these two lines with asterisk ******/
- },
- });
- // close the iframe window
- $(document).on('click', '.popup-modal-dismiss', function (e) {
- $.magnificPopup.close();
- });
- });
- })(jQuery);
- </script>
- <?php }}
- add_action('wp_footer', 'popup_masonry_gallery');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement