Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

初始化emoji面板后页面内容有变化时,emoji面板位置显示异常 #16

Open
lanomw opened this issue Mar 4, 2021 · 0 comments

Comments

@lanomw
Copy link

lanomw commented Mar 4, 2021

存在懒加载页面时,emoji面板位置显示异常

image

  • 这里的图片为懒加载,图片加载完成后emoji面板位置没有进行更新
  • 期望在每次打开面板时重新更新下位置,下面是我的更改代码
    •      // 在源码`$(document).on()`内,大概位于197行
          if (target === $(btn)[0]) {
                  var _panelTop,_panelLeft;
                  // 重新计算位置。防止收到图片懒加载之类的影响
                  switch (that.options.position) {
                      case 'topLeft':
                          _panelTop = $(btn).offset().top - $('#emoji_container_' + ix).outerHeight() - 5;
                          _panelLeft = $(btn).offset().left - $('#emoji_container_' + ix).outerWidth() + $(btn).outerHeight();
                          break;
                      case 'topRight':
                          _panelTop = $(btn).offset().top - $('#emoji_container_' + ix).outerHeight() - 5;
                          _panelLeft = $(btn).offset().left;
                          break;
                      case 'bottomLeft':
                          _panelTop = $(btn).offset().top + $(btn).outerHeight() + 5;
                          _panelLeft = $(btn).offset().left - $('#emoji_container_' + ix).outerWidth() + $(btn).outerHeight();
                          break;
                      default:
                          _panelTop = $(btn).offset().top + $(btn).outerHeight() + 5;
                          _panelLeft = $(btn).offset().left;
                  }
                  if (_panelTop !== panelTop || _panelLeft !== panelLeft) {
                      panelTop = _panelTop;
                      panelLeft = _panelLeft;
                      $('#emoji_container_' + ix).css({ 'top': panelTop + 'px', 'left': panelLeft + 'px' });
                  }
                  $('#emoji_container_' + ix)[that.toggleFunc]();
                  that.$content.focus();
              }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant