HTMLGuyLLC / jAlert

jQuery alert/modal/lightbox plugin
https://htmlguyllc.github.io/jAlert/
MIT License
76 stars 35 forks source link

in firefox it shows vertical scroll bar only while it's loading jAlert #49

Closed wirelesss closed 6 years ago

wirelesss commented 6 years ago

In firefox v51.0.1 64 bits (windows 10) while the jAlert is showing from bottom to top, then vertical scrollbar of document is showed, later, jAlert is loaded and the scrollbar is hidden.

I found how to fix this problem: Original:

L95:            centerAlert: function()
L96:            {
L97:                var viewportHeight = $(window).height(),
L98:                alertHeight = alert.instance.height(),
L99:                diff = viewportHeight - alertHeight;

Fixed:

L95:            centerAlert: function()
L96:            {   // fix next line: add *0.75
L97:                var viewportHeight = $(window).height()*0.75,
L98:                    alertHeight = alert.instance.height(),
L99:                    diff = viewportHeight - alertHeight;

I hope this it will be useful for someone.

ChristianGabs commented 6 years ago

This is not centered if you apply this code.

Let's have a look the difference between them

On full screen

**Without 0.75** : 689

**jAlert.js:101 With 0.75** : 516.75

**jAlert.js:102 Diff applied** : 417.75

On half screen

**Without 0.75** : 602

**jAlert.js:101 With 0.75** : 451.5

**jAlert.js:102 Diff applied** : 352.5

So on your case you applied a top multiplied with 0.75

So instand of FULL SCREEN (top : 602) will be FULL SCREEN (top:516.75) and diff will be Fullscreen (417.75)

The diference now on style will be like

Applied 0.75 margin-top: 107.875px; Without 0.75 margin-top: 194px;

Be aware we speaking about my screen on resolution 1920 x 1080

PS: Could be your styling override margin-top or other styling affecting to show the scrollbar

PS2 : Your method will move the dialog up with 94px