@lemonadejs/modal 2.7.1 → 2.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +21 -6
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -280,7 +280,7 @@ if (!lemonade && typeof (require) === 'function') {
280
280
 
281
281
  if (self.position) {
282
282
  if (self.position === 'absolute') {
283
- viewportWidth = document.documentElement.clientWidth;
283
+ viewportWidth = document.documentElement.offsetWidth;
284
284
  } else if (self.position !== 'center') {
285
285
  margin = 0;
286
286
  }
@@ -288,9 +288,17 @@ if (!lemonade && typeof (require) === 'function') {
288
288
 
289
289
  let rightEdgeDistance = viewportWidth - (self.el.offsetLeft + self.el.offsetWidth);
290
290
  let transformX = 0;
291
- if (rightEdgeDistance < 0) {
292
- transformX = rightEdgeDistance - margin;
291
+
292
+ if (self.position === 'absolute') {
293
+ if (rightEdgeDistance < 5) {
294
+ transformX = (-1 * self.el.offsetWidth) - margin;
295
+ }
296
+ } else {
297
+ if (rightEdgeDistance < 0) {
298
+ transformX = rightEdgeDistance - margin;
299
+ }
293
300
  }
301
+
294
302
  if (self.el.offsetLeft < 0) {
295
303
  transformX = margin - self.el.offsetLeft;
296
304
  }
@@ -310,7 +318,7 @@ if (!lemonade && typeof (require) === 'function') {
310
318
 
311
319
  if (self.position) {
312
320
  if (self.position === 'absolute') {
313
- viewportHeight = document.documentElement.clientHeight;
321
+ viewportHeight = document.documentElement.offsetHeight;
314
322
  } else if (self.position !== 'center') {
315
323
  margin = 0;
316
324
  }
@@ -318,8 +326,15 @@ if (!lemonade && typeof (require) === 'function') {
318
326
 
319
327
  let bottomEdgeDistance = viewportHeight - (self.el.offsetTop + self.el.offsetHeight);
320
328
  let transformY = 0;
321
- if (bottomEdgeDistance < 0) {
322
- transformY = bottomEdgeDistance - margin;
329
+
330
+ if (self.position === 'absolute') {
331
+ if (bottomEdgeDistance < 5) {
332
+ transformY = (-1 * self.el.offsetHeight) - margin;
333
+ }
334
+ } else {
335
+ if (bottomEdgeDistance < 0) {
336
+ transformY = bottomEdgeDistance - margin;
337
+ }
323
338
  }
324
339
 
325
340
  if (self.el.offsetTop < 0) {
package/package.json CHANGED
@@ -13,9 +13,9 @@
13
13
  "modal js"
14
14
  ],
15
15
  "dependencies": {
16
- "lemonadejs": "^4.0.7"
16
+ "lemonadejs": "^4.1.1"
17
17
  },
18
18
  "main": "dist/index.js",
19
19
  "types": "dist/index.d.ts",
20
- "version": "2.7.1"
20
+ "version": "2.7.2"
21
21
  }