Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

兼容怪异模式下获取scrollTop和scrollLeft #3245

Open
wants to merge 1 commit into
base: dev-1.5.0
Choose a base branch
from
Open

兼容怪异模式下获取scrollTop和scrollLeft #3245

wants to merge 1 commit into from

Conversation

oasis-cloud
Copy link

在怪异模式下上传图片后,点选上传的图片,图片缩放的覆盖层定位出现盘查。
wx20180531-174423

@AlxeMJ
Copy link

AlxeMJ commented Apr 24, 2019

在怪异模式下上传图片后,点选上传的图片,图片缩放的覆盖层定位出现盘查。
wx20180531-174423

--ueditor.all.js--
domUtils.setStyles(resizer, {
'width': target.width + 'px',
'height': target.height + 'px',
'left': iframePos.x + imgPos.x - me.editor.document.body.scrollLeft - editorPos.x - parseInt(resizer.style.borderLeftWidth) + 'px',
'top': iframePos.y + imgPos.y - me.editor.document.body.scrollTop - editorPos.y - parseInt(resizer.style.borderTopWidth) + 'px'
});

replace 'body' to 'documentElement',like this:
domUtils.setStyles(resizer, {
'width': target.width + 'px',
'height': target.height + 'px',
'left': iframePos.x + imgPos.x - me.editor.document.documentElement.scrollLeft - editorPos.x - parseInt(resizer.style.borderLeftWidth) + 'px',
'top': iframePos.y + imgPos.y - me.editor.document.documentElement.scrollTop - editorPos.y - parseInt(resizer.style.borderTopWidth) + 'px'
});

@Dafrok
Copy link
Member

Dafrok commented Apr 24, 2019

非怪异模式的 documentElement 也可能会有 scrollTop 和 scrollLeft 的

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants