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

body标签被加上 style无法清理 #394

Closed
Ucer opened this issue Jun 2, 2020 · 2 comments
Closed

body标签被加上 style无法清理 #394

Ucer opened this issue Jun 2, 2020 · 2 comments

Comments

@Ucer
Copy link

Ucer commented Jun 2, 2020

预览过viewerjs之后, 自动在我的 body层加了个 style,destroy也不能清除,导致页面样式出问题

<body style="overflow: hidden; padding-right: 0px;">

版本信息 "viewerjs": "^1.5.0"

    var viewer = new window.Viewer(this.$refs.galleyPhoto, {
              url: 'data-original',
              hidden: function() {
                viewer.destroy()
              }
            })
            viewer.show()

2020-06-03 06-42-01屏幕截图

我现在的解决方案是要手动清理一下body样式

    var viewer = new window.Viewer(this.$refs.galleyPhoto, {
              url: 'data-original',
              hidden: function() {
                viewer.destroy()
                 document.querySelector('body').removeAttribute('style')
              }
            })
            viewer.show()
@fengyuanchen
Copy link
Owner

你说的是 overflow: hidden 吧?这个属性不是 Viewer.js 加的,至于 padding-right: 0px 应该没有不良影响的吧。

@fengyuanchen
Copy link
Owner

已进行优化,当 padding-right 等于 0px 时,会将其移除。

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

2 participants