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

水印图层会撑开页面高度 #33

Closed
JeanZhao opened this issue Nov 15, 2019 · 5 comments
Closed

水印图层会撑开页面高度 #33

JeanZhao opened this issue Nov 15, 2019 · 5 comments

Comments

@JeanZhao
Copy link

var page_height = Math.max(watermark_hook_element.scrollHeight,watermark_hook_element.clientHeight,document.documentElement.clientHeight);

这里获取的是页面最大高度,感觉应该是获取加水印容器的高度吧?为什么要加上 document.documentElement.clientHeight ?

@paperscz
Copy link

同存撑开了页面高度的问题

@JeanZhao
Copy link
Author

JeanZhao commented Nov 19, 2019

我用的这个方案解决的:
直接引用watermark.js文件,并把我上面提到的那行代码改成:
var page_height = watermark_parent_element ? Math.max(watermark_hook_element.scrollHeight,watermark_hook_element.clientHeight) :(Math.max(watermark_hook_element.scrollHeight,watermark_hook_element.clientHeight,document.documentElement.clientHeight)-defaultSettings.watermark_height/2);

就可以了。

@saucxs
Copy link
Owner

saucxs commented Nov 19, 2019

在2.2.1版本中已经修复,谢谢指出,以后可以直接提 pull request @JeanZhao @paperscz

@saucxs saucxs closed this as completed Nov 19, 2019
@guoshengbo
Copy link

兄弟 2.2.1没改啊,看了源码 你还是原来的代码啊

@JeanZhao
Copy link
Author

JeanZhao commented Nov 20, 2019

兄弟 2.2.1没改啊,看了源码 你还是原来的代码啊

源码调整了,但是没有用我给的代码。
你是不是没有设置watermark_parent_node?我没设置也有这问题。你可以试试我上面的代码方案。

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

4 participants