在Android的窗口大小调整中,lightbox消失了

lightbox disappears of view from window resize in Android

本文关键字:lightbox 消失了 调整 Android 窗口大小      更新时间:2023-09-26

灯箱显示在右侧位置(上/左居中),但是当用户缩放;灯光保持在相同的位置(不考虑窗口/视图已被调整大小/裁剪),

你可以在这里测试一下点击标题的蓝色按钮

我正在检查灯箱的代码,我可以看到

$(window).bind('resize', $.proxy(function() {
          if (this.visible)
          {
            this.overlay.resize();
            if (!this.maximized) {
              this.movebox();
            }
          }
        }, this));

WHERE MOVEBOX() IS:

function(w, h) {
        var size   = { x: $(window).width(),      y: $(window).height() };
        var scroll = { x: $(window).scrollLeft(), y: $(window).scrollTop() };
        var height = h!=null ? h : this.esqueleto.lightbox.outerHeight();
        var width  = w!=null ? w : this.esqueleto.lightbox.outerWidth();
        var y      = 0;
        var x      = 0;
         //vertically center
        x = scroll.x + ((size.x - width) / 2);
        if (this.visible) {
          y = scroll.y + (size.y - height) / 2;
        } else if (this.options.emergefrom == "bottom") {
          y = (scroll.y + size.y + 14);
        } else {// top
          y = (scroll.y - height) - 14;
        }
        if (this.visible) {
          if (!this.animations.move) {
            this.morph(this.esqueleto.move, {
              'left' : x
            }, 'move');
          }
          this.morph(this.esqueleto.move, {
            'top'  : y
          }, 'move');
        } else {
          this.esqueleto.move.css({
            'left' : x,
            'top'  : y
          });
        }
      }

问题是:我如何才能正确地计算新的高度和新的,所以灯箱遵循srcoll/zoom在android(也在iphone它移动了一点)

我对window.resize()函数的move()元素在Android上不工作的回答可能会为您提供一些关于该主题的信息。我猜你的scrollLeft()遇到了一些问题。

悲伤时刻: