当popific popup打开时隐藏div

[英]Hide a div when magnific popup opens


Hi i use magnific pop up for an image gallery and i want to hide a div when the image zoom in and show it again when the image zoom out. This is my code :

嗨我使用magnific弹出一个图像库,我想在图像放大时隐藏div,并在图像缩小时再次显示。这是我的代码:

 $('.gallery-item').magnificPopup({
        type: 'image',
        gallery:{
          enabled:true
        },
        mainClass: 'mfp-with-zoom', // this class is for CSS animation below

        zoom: {
        enabled: true, // By default it's false, so don't forget to enable it

        duration: 300, // duration of the effect, in milliseconds
        easing: 'ease-in-out',


         // CSS transition easing function

        // The "opener" function should return the element from which popup will be zoomed in
        // and to which popup will be scaled down
        // By defailt it looks for an image tag:
        opener: function(openerElement) {
          // openerElement is the element on which popup was initialized, in this case its <a> tag
         // you don't need to add "opener" option if this code matches your needs, it's defailt one.
         return openerElement.is('img') ? openerElement : openerElement.find('img');
       }
      }

});

Where should i put the the hide() and show() functions so they will be triggered same time with the magnific popup.

我应该在哪里放置hide()和show()函数,以便在弹出的同时触发它们。

2 个解决方案

#1


0  

Don't use css for that, jQuery has built in functions for showing and hiding elements.

不要使用css,jQuery内置了显示和隐藏元素的函数。

open: function(){
  $(".main").hide();
},
  close: function(){
  $(".hidden-div").show();
}

#2


0  

Use this $( ".main" ).hide(); in your open function.

使用此$(“。main”)。hide();在你的开放功能。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.itdaan.com/blog/2015/11/19/3a6845b2d0f7810c133f1a23c7fdb3ed.html



 
© 2014-2019 ITdaan.com 粤ICP备14056181号