nice-toast-js
Version:
jquery easy & nice Toast
630 lines (525 loc) • 11.6 kB
CSS
/*!
* nice-toast-js 1.0.0
* Made with create-jquery-plugin
*
* Created by hasan ahani <hasanahani.ir@gmail.com>
*
* @license MIT
*/
.nice-toast-wrapper {
position: fixed;
padding: 4px;
width: 600px;
box-sizing: border-box;
display: flex;
min-height: 100%;
color: #fff;
flex-direction: column;
pointer-events: none;
z-index: 9999;
}
.nice-toast-wrapper[class*=' top'] {
top: 1em;
}
.nice-toast-wrapper[class*=' bottom'] {
bottom: 1em;
flex-direction: column-reverse;
}
.nice-toast-wrapper[class$=left] {
left: 1em;
}
.nice-toast-wrapper[class$=left] .nice-toast {
margin-right: auto;
}
.nice-toast-wrapper[class$=right] {
right: 1em;
}
.nice-toast-wrapper[class$=right] .nice-toast {
margin-left: auto;
}
.nice-toast-wrapper[class$=center] {
left: 50%;
margin-left: -300px;
}
.nice-toast-wrapper[class$=center] .nice-toast {
margin-left: auto;
margin-right: auto;
}
.nice-toast {
display: inline-flex;
position: relative;
max-height: 800px;
min-height: 64px;
box-sizing: border-box;
margin-bottom: 1rem;
box-shadow: rgba(0, 0, 0, 0.1) 0 1px 10px 0, rgba(0, 0, 0, 0.05) 0 2px 15px 0;
justify-content: space-between;
font-family: inherit, Lato, Helvetica, Roboto, Arial, sans-serif;
max-width: 600px;
min-width: 326px;
pointer-events: auto;
transform: translateZ(0px);
padding: 22px 24px;
border-radius: 8px;
overflow: hidden;
}
.nice-toast-icon {
align-items: center;
width: 20px;
height: 100%;
margin: auto 18px auto 0;
background: transparent;
outline: none;
border-width: initial;
border-style: none;
border-color: initial;
-o-border-image: initial;
border-image: initial;
padding: 0;
transition: all 0.3s ease 0s;
}
.nice-toast-content {
line-height: 24px;
font-size: 16px;
word-break: break-word;
white-space: pre-wrap;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
width: 100%;
}
.nice-toast-progress {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 5px;
z-index: 10000;
background-color: rgba(255, 255, 255, 0.7);
transform-origin: left;
-webkit-animation: scale-x-frames linear 1 forwards;
animation: scale-x-frames linear 1 forwards;
}
@-webkit-keyframes scale-x-frames {
0% {
transform: scaleX(1);
}
to {
transform: scaleX(0);
}
}
@keyframes scale-x-frames {
0% {
transform: scaleX(1);
}
to {
transform: scaleX(0);
}
}
.nice-toast-close {
font-weight: 700;
font-size: 24px;
line-height: 24px;
cursor: pointer;
align-items: center;
color: white;
opacity: 0.3;
background: transparent;
outline: none;
border-width: initial;
border-style: none;
border-color: initial;
-o-border-image: initial;
border-image: initial;
padding: 0 0 0 10px;
transition: visibility 0s ease 0s, opacity 0.2s linear 0s;
}
.nice-toast-close:hover {
opacity: 1;
}
.nice-toast-default {
background-color: #00A3FF;
}
.nice-toast-success {
background-color: #20D489;
}
.nice-toast-info {
background-color: #00A3FF;
}
.nice-toast-warning {
background-color: #FFC700;
}
.nice-toast-error {
background-color: #F1416C;
}
@-webkit-keyframes bounceInRight {
from,
60%,
75%,
90%,
to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
}
from {
opacity: 0;
transform: translate3d(3000px, 0, 0);
}
60% {
opacity: 1;
transform: translate3d(-25px, 0, 0);
}
75% {
transform: translate3d(10px, 0, 0);
}
90% {
transform: translate3d(-5px, 0, 0);
}
to {
transform: none;
}
}
@keyframes bounceInRight {
from,
60%,
75%,
90%,
to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
}
from {
opacity: 0;
transform: translate3d(3000px, 0, 0);
}
60% {
opacity: 1;
transform: translate3d(-25px, 0, 0);
}
75% {
transform: translate3d(10px, 0, 0);
}
90% {
transform: translate3d(-5px, 0, 0);
}
to {
transform: none;
}
}
@-webkit-keyframes bounceOutRight {
40% {
opacity: 1;
transform: translate3d(-20px, 0, 0);
}
to {
opacity: 0;
transform: translate3d(1000px, 0, 0);
}
}
@keyframes bounceOutRight {
40% {
opacity: 1;
transform: translate3d(-20px, 0, 0);
}
to {
opacity: 0;
transform: translate3d(1000px, 0, 0);
}
}
@-webkit-keyframes bounceInLeft {
from,
60%,
75%,
90%,
to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
}
0% {
opacity: 0;
transform: translate3d(-3000px, 0, 0);
}
60% {
opacity: 1;
transform: translate3d(25px, 0, 0);
}
75% {
transform: translate3d(-10px, 0, 0);
}
90% {
transform: translate3d(5px, 0, 0);
}
to {
transform: none;
}
}
@keyframes bounceInLeft {
from,
60%,
75%,
90%,
to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
}
0% {
opacity: 0;
transform: translate3d(-3000px, 0, 0);
}
60% {
opacity: 1;
transform: translate3d(25px, 0, 0);
}
75% {
transform: translate3d(-10px, 0, 0);
}
90% {
transform: translate3d(5px, 0, 0);
}
to {
transform: none;
}
}
@-webkit-keyframes bounceOutLeft {
20% {
opacity: 1;
transform: translate3d(20px, 0, 0);
}
to {
opacity: 0;
transform: translate3d(-2000px, 0, 0);
}
}
@keyframes bounceOutLeft {
20% {
opacity: 1;
transform: translate3d(20px, 0, 0);
}
to {
opacity: 0;
transform: translate3d(-2000px, 0, 0);
}
}
@-webkit-keyframes bounceInUp {
from,
60%,
75%,
90%,
to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
}
from {
opacity: 0;
transform: translate3d(0, 3000px, 0);
}
60% {
opacity: 1;
transform: translate3d(0, -20px, 0);
}
75% {
transform: translate3d(0, 10px, 0);
}
90% {
transform: translate3d(0, -5px, 0);
}
to {
transform: translate3d(0, 0, 0);
}
}
@keyframes bounceInUp {
from,
60%,
75%,
90%,
to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
}
from {
opacity: 0;
transform: translate3d(0, 3000px, 0);
}
60% {
opacity: 1;
transform: translate3d(0, -20px, 0);
}
75% {
transform: translate3d(0, 10px, 0);
}
90% {
transform: translate3d(0, -5px, 0);
}
to {
transform: translate3d(0, 0, 0);
}
}
@-webkit-keyframes bounceOutUp {
20% {
transform: translate3d(0, -10px, 0);
}
40%,
45% {
opacity: 1;
transform: translate3d(0, 20px, 0);
}
to {
opacity: 0;
transform: translate3d(0, -2000px, 0);
}
}
@keyframes bounceOutUp {
20% {
transform: translate3d(0, -10px, 0);
}
40%,
45% {
opacity: 1;
transform: translate3d(0, 20px, 0);
}
to {
opacity: 0;
transform: translate3d(0, -2000px, 0);
}
}
@-webkit-keyframes bounceInDown {
from,
60%,
75%,
90%,
to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
}
0% {
opacity: 0;
transform: translate3d(0, -3000px, 0);
}
60% {
opacity: 1;
transform: translate3d(0, 25px, 0);
}
75% {
transform: translate3d(0, -10px, 0);
}
90% {
transform: translate3d(0, 5px, 0);
}
to {
transform: none;
}
}
@keyframes bounceInDown {
from,
60%,
75%,
90%,
to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
}
0% {
opacity: 0;
transform: translate3d(0, -3000px, 0);
}
60% {
opacity: 1;
transform: translate3d(0, 25px, 0);
}
75% {
transform: translate3d(0, -10px, 0);
}
90% {
transform: translate3d(0, 5px, 0);
}
to {
transform: none;
}
}
@-webkit-keyframes bounceOutDown {
20% {
transform: translate3d(0, 10px, 0);
}
40%,
45% {
opacity: 1;
transform: translate3d(0, -20px, 0);
}
to {
opacity: 0;
transform: translate3d(0, 2000px, 0);
}
}
@keyframes bounceOutDown {
20% {
transform: translate3d(0, 10px, 0);
}
40%,
45% {
opacity: 1;
transform: translate3d(0, -20px, 0);
}
to {
opacity: 0;
transform: translate3d(0, 2000px, 0);
}
}
@keyframes bounceOutDown {
20% {
transform: translate3d(0, 10px, 0);
}
40%,
45% {
opacity: 1;
transform: translate3d(0, -20px, 0);
}
to {
opacity: 0;
transform: translate3d(0, 2000px, 0);
}
}
.nice-toast-bounce-enter-active, .nice-toast-bounce-leave-active {
transition-property: transform, opacity;
-webkit-animation-duration: 750ms;
animation-duration: 750ms;
-webkit-animation-delay: 0ms;
animation-delay: 0ms;
}
.top-left .nice-toast-bounce-leave-active, .bottom-left .nice-toast-bounce-leave-active {
-webkit-animation-name: bounceOutLeft;
animation-name: bounceOutLeft;
}
.top-left .nice-toast-bounce-enter-active, .bottom-left .nice-toast-bounce-enter-active {
-webkit-animation-name: bounceInLeft;
animation-name: bounceInLeft;
}
.top-right .nice-toast-bounce-leave-active, .bottom-right .nice-toast-bounce-leave-active {
-webkit-animation-name: bounceOutRight;
animation-name: bounceOutRight;
}
.top-right .nice-toast-bounce-enter-active, .bottom-right .nice-toast-bounce-enter-active {
-webkit-animation-name: bounceInRight;
animation-name: bounceInRight;
}
.top-center .nice-toast-bounce-leave-active {
-webkit-animation-name: bounceOutUp;
animation-name: bounceOutUp;
}
.top-center .nice-toast-bounce-enter-active {
-webkit-animation-name: bounceInDown;
animation-name: bounceInDown;
}
.bottom-center .nice-toast-bounce-leave-active {
-webkit-animation-name: bounceOutDown;
animation-name: bounceOutDown;
}
.bottom-center .nice-toast-bounce-enter-active {
-webkit-animation-name: bounceInUp;
animation-name: bounceInUp;
}
.nice-toast-bounce-move {
transition-timing-function: ease-in-out;
transition-property: all;
transition-duration: 400ms;
}