center_popup
Advanced tools
Comparing version 1.0.9 to 1.1.0
@@ -51,3 +51,3 @@ /*! | ||
if (document.getElementById('popup-style')) return; | ||
var e = ".popup-wrapper{position:fixed;width:100vw;height:100vh;top:0;left:0;background:rgba(0, 0, 0, 0.7)}.popup-wrapper .popup-inner{position:absolute;top:50%;transform:translateY(-50%);left:0;right:0;margin:auto;background:#fff;max-width:576px;max-height:90%;overflow:auto}@media (max-width: 768px){.popup-wrapper .popup-inner{max-width:320px}}@keyframes popupFadeIn{0%{opacity:0}100%{opacity:1}}@keyframes popupFadeOut{0%{opacity:1}100%{opacity:0}}@keyframes popupFadeInDown{0%{opacity:0;transform:translateY(-100%)}100%{opacity:1}}", | ||
var e = ".popup-wrapper{position:fixed;width:100vw;height:100vh;top:0;left:0;background:rgba(0,0,0,.7)}.popup-wrapper .popup-inner{position:absolute;top:50%;transform:translateY(-50%);left:0;right:0;margin:auto;background:#fff;max-width:576px;max-height:90%;overflow:auto}.popup-wrapper.fade-in,.popup-wrapper.fade-in-down{animation-name:popupFadeIn;animation-duration:.3s}.popup-wrapper.fade-in-down .popup-inner{animation-name:popupFadeInDown;animation-duration:.3s}.popup-wrapper.fade-out{animation-name:popupFadeOut;animation-duration:.3s}@media (max-width:768px){.popup-wrapper .popup-inner{max-width:320px}}@keyframes popupFadeIn{0%{opacity:0}100%{opacity:1}}@keyframes popupFadeOut{0%{opacity:1}100%{opacity:0}}@keyframes popupFadeInDown{0%{opacity:0;transform:translateY(-100%)}100%{opacity:1}}", | ||
t = document.createElement("style"); | ||
@@ -113,16 +113,15 @@ | ||
self.fadeIn = function(s = .3) { | ||
self.fadeIn = function() { | ||
self.open(template => { | ||
template.style.animation = 'popupFadeIn '+s+'s'; | ||
template.classList.add('fade-in'); | ||
}); | ||
} | ||
self.fadeInDown = function(s = .3) { | ||
self.fadeInDown = function() { | ||
self.open(template => { | ||
template.style.animation = 'popupFadeIn '+s+'s'; | ||
self.node.parentNode.style.animation = 'popupFadeInDown '+s+'s'; | ||
template.classList.add('fade-in-down'); | ||
}); | ||
} | ||
self.fadeOut = function(s = .3) { | ||
self.fadeOut = function() { | ||
self.close(wrapper => { | ||
@@ -132,3 +131,3 @@ wrapper.addEventListener('animationend', function() { | ||
}) | ||
wrapper.style.animation = 'PopupFadeOut '+s+'s'; | ||
wrapper.classList.add('fade-out'); | ||
}) | ||
@@ -135,0 +134,0 @@ } |
{ | ||
"name": "center_popup", | ||
"version": "1.0.9", | ||
"version": "1.1.0", | ||
"description": "A library for creating a centered popup window", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -31,3 +31,3 @@ # center-popup.js | ||
// or | ||
popup.fadeIn(.3); | ||
popup.fadeIn(); | ||
@@ -37,3 +37,3 @@ // easily close it by | ||
// or | ||
popup.fadeOut(.3); | ||
popup.fadeOut(); | ||
``` | ||
@@ -114,18 +114,12 @@ | ||
- **fadeIn(seconds)** | ||
- **fadeIn()** | ||
Type: `Number` Default: `0.3` | ||
FadeIn the centered popup window in specific time. | ||
- **fadeInDown(seconds)** | ||
- **fadeInDown()** | ||
Type: `Number` Default: `0.3` | ||
FadeInDown the centered popup window in specific time. | ||
- **fadeOut(seconds)** | ||
- **fadeOut()** | ||
Type: `Number` Default: `0.3` | ||
FadeOut the centered popup window in specific time. | ||
@@ -132,0 +126,0 @@ |
Sorry, the diff of this file is not supported yet
13932
127