viewerjs
viewerjs copied to clipboard
Padding-right on body can't be switched off
I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
Current behavior
If I open viewer.js in modal padding-right is always added to the body.
It is done here: https://github.com/fengyuanchen/viewerjs/blob/master/src/js/others.js#L26
Expected behavior
I expect additional option to turn off/on this feature.
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Currently is breaks layout in our project.
Environment
Viewer.js version: 1.2.0
Browser:
- [x] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [x] Firefox version XX
- [x] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [x] IE version XX
- [x] Edge version XX
Others:
same here, not even sure, why you need this additional padding...
same here, it makes all my app litteraly jumping on the left (especially with vuejs app)
I literally fixed it like this:
let viewer = new Viewer(document.querySelector("#image"), { navbar: false, } });
//here
viewer.close = function(){}
viewer.open = function(){}
Please put this ugly padding in a class that can be overridden.
any news?
I also noticed the same problem with the body being added with a padding-right causing the style on the background to jitter when the viewer pops up.
In addition, if the user has modified the padding-right style of the body after loading the viewer, the value will be lost after popping up the viewer and closing it.
I suggest leaving this part up to the user to define, for example, setting the .viewer-open
style.
我也注意到了同样问题,body被添加了一个padding-right导致弹出viewer时背景上的样式发生抖动。
另外,如果用户在加载viewer后又修改过body的padding-right样式,弹出viewer并关闭后设置值会丢失。
我建议这部分逻辑让用户自己定义就好,比如设置.viewer-open
样式。