打开放大镜弹出窗口时隐藏div



嗨,我使用放大镜弹出图像库,我想在图像放大时隐藏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');
       }
      }
});

我应该把hide()和show()函数放在哪里,这样它们就会和放大镜弹出窗口同时触发。

不要使用css,jQuery内置了显示和隐藏元素的函数。
open: function(){
  $(".main").hide();
},
  close: function(){
  $(".hidden-div").show();
}

在打开函数中使用此$( ".main" ).hide();

最新更新