如何获取自定义属性数据Magnific Popup

时间:2016-07-05 07:45:07

标签: javascript jquery magnific-popup

我是网络开发的新手。我需要有关如何获取" mydesc"的属性值的帮助。以及如何将其包含在弹出图像中。

非常感谢任何帮助。

HTML:

<ul class="thumbnails">
                     <li class="image-additional"><a class="thumbnail" href="bigpic1.png" title="pic1 title" mydesc="this is a description1"> <img id="png1" 

src="pic1.png" title="DG0001" alt="DG0001"></a>
                     </li>
                     <li class="image-additional"><a class="thumbnail" href="bigpic2.png" title="pic2 title" mydesc="this is a description2"> <img id="png1" 

src="pic2.png" title="DG0002" alt="DG0002"></a>
                     </li>
                     <li class="image-additional"><a class="thumbnail" href="bigpic3.png" title="pic3 title" mydesc="this is a description3"> <img id="png1" 

src="pic3.png" title="DG0003" alt="DG0003"></a>
                     </li>
</ul>

的javascript:

                $('.thumbnails').magnificPopup({
                    type:'image',
                    delegate: '.image-additional a:visible',
                    image: {
                markup: '<div class="mfp-figure">'+
                        '<div class="mfp-close"></div>'+
                        '<div class="mfp-img"></div>'+ 
                        '<div class="mfp-title"></div>'+
                        '<div class="mfp-mydesc"></div>'+  ---> no value
                    '<div class="mfp-bottom-bar">'+
                        '<div class="mfp-counter"></div>'+
                        '</div>'+
                            '</div>', 
                 cursor: 'mfp-zoom-out-cur',
                  tError: '<a href="%url%">The image</a> could not be loaded.'
                  },
                  preloader: true,
                    gallery: {
                        enabled:true
                    }

                });

0 个答案:

没有答案