t4t5 / sweetalert

A beautiful replacement for JavaScript's "alert"
https://sweetalert.js.org
MIT License
22.4k stars 2.84k forks source link

set body class "stop-scrolling" as a configurable param #362

Open geeyan opened 9 years ago

geeyan commented 9 years ago

Original code will automatically toggle DOM body class "stop-scrolling", cause browser page shake. This will do harm to user experience. I suggest that "stop-scrolling" class as a configurable param.

t4t5 commented 9 years ago

Hm I guess this is on Windows machines where the scroll bars occupy a space of their own, right?

Is there any way to disable scrolling without having that "shake"?

geeyan commented 9 years ago

Yes, windows 7+chrome. see: http://www.zhihu.com/question/21865401/answer/22964112 http://jsfiddle.net/21freestyle/BhRpe/1/

rafaelrenanpacheco commented 9 years ago

:+1: on this.

I had to delete the following CSS to avoid the page shaking:

body.stop-scrolling {
  height: 100%;
  overflow: hidden; }
jmartsch commented 9 years ago

Problem also appears on Windows 10 + chrome + Edge + Firefox

ghost commented 9 years ago

This also happens on Mac when "show scrollbars" is set to "always" in the OS - quite jarring.

marcortw commented 8 years ago

+1

JamoCA commented 8 years ago

I added the following CSS override to the page I was using it. There may be valid cases for changing the height/overflow for use with mobile. (Perhaps this rule should only be performed for desktop users and not with tablet/mobile devices.)

<style type="text/css">
body.stop-scrolling {height:auto !important; overflow:visible !important;}
</style>

Disclaimer: You should modify this to set it to whatever your framework uses and test it on multiple devices, but this may be a better/safer solution than removing the CSS from the plugin's library. (BrowserStack.com is a good tool for previewing the effects using multiple virtual OS/device combinations.)

zxw5775 commented 8 years ago

+1

rafaelrenanpacheco commented 8 years ago

Consider migrate your project to sweetalert2

This problem, and many others, does not exists there.