I was working on a custom design On WordPress website ,
But I'm stuck in a problem and I don't know how to solve it.
The end result is supposed to be like this :
result
but I am getting this result In my end :
img
The problem is that the closing (x) does not appear.
code :
/* Pop Up Animation Ramadan */
#keyframes flipInX {
from {
transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
animation-timing-function: ease-in;
opacity: 0
}
40% {
transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
animation-timing-function: ease-in
}
60% {
transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
opacity: 1
}
80% {
transform: perspective(400px) rotate3d(1, 0, 0, -5deg)
}
to {
transform: perspective(400px)
}
}
#keyframes change_color {
0% {
background: #5ac7da
}
33.33% {
background: #3173bd
}
66.66% {
background: #0d4a8d
}
100% {
background: #5ac7da
}
}
#keyframes run_hari18 {
0% {
transform: translate(0%, 0);
opacity: 0
}
50% {
transform: translate(100%, 0);
opacity: 1
}
100% {
transform: translate(100%, 0);
opacity: 0
}
}
#keyframes sun_movement {
0% {
top: 50px
}
100% {
top: 50px
}
}
#keyframes run_malam18 {
0% {
transform: translate(-20%, 0);
opacity: 0
}
49.99% {
transform: translate(0%, 0);
opacity: 1
}
99.99% {
transform: translate(20%, 0);
opacity: 0
}
100% {
transform: translate(-20%, 0);
opacity: 1
}
}
#keyframes moon_movement {
0% {
transform: translate(-200%, 0);
opacity: 0
}
49.99% {
transform: translate(0%, 0);
opacity: 1
}
99.99% {
transform: translate(200%, 0);
opacity: 0
}
100% {
transform: translate(-200%, 0);
opacity: 1
}
}
/*custom*/
#arlinapuasa2018 {
display: block;
background: #fff;
position: fixed;
top: 25%;
right: 0;
left: 0;
margin: auto;
text-align: center;
max-width: 660px;
box-shadow: 0 19px 38px rgba(0, 0, 0, 0.1), 0 15px 12px rgba(0, 0, 0, 0.12);
z-index: 99;
min-height: 350px;
padding: 20px;
overflow: hidden;
border-radius: 10px;
animation: change_color 7s infinite linear, flipInX 1s linear
}
#arlinapuasa2018 .puasa18 {
position: absolute;
color: #fff;
font-size: 2rem;
font-weight: 400;
padding: 30px;
z-index: 99999;
text-align: center;
margin: auto;
left: 0;
right: 0;
top: 20%
}
#arlinapuasa2018 .puasa18 p {
margin: 20px auto 20px;
text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2)
}
#arlinapuasa2018 .puasa18 .ramadan2018 {
font-size: 3rem;
font-weight: 700
}
#arlinapuasa2018 a.close-popup {
position: absolute;
bottom: 1px;
right: 1px;
color: #fff;
text-align: center;
border-radius: 100%;
cursor: pointer;
z-index: 999999;
transition: all .3s
}
#arlinapuasa2018 a.close-popup:hover {
color: #fff
}
#arlinapuasa2018 a.close-popup:active {
opacity: 0
}
#arlinapuasa2018 a.close-popup i {
font-family: fontawesome;
font-size: 20px;
font-weight: normal;
font-style: normal;
transform: rotate(270deg);
transition: all .3s
}
#arlinapuasa2018 a.close-popup:hover i {
transform: rotate(360deg)
}
.gunung18 {
width: 400px;
height: 300px;
display: block;
background: #4aad52;
position: absolute;
bottom: -150px;
transform: rotate(45deg);
border-radius: 50px;
z-index: 2;
left: 0;
}
.gunung18.behind {
background: #42a54a;
right: -120px;
bottom: -180px;
z-index: 1
}
.hari18 {
width: 100%;
height: 100%;
display: block;
position: absolute;
top: 0;
left: 0;
animation: run_hari18 7s infinite linear
}
.hari18 .awan18 {
margin: 30px auto;
width: 150px;
height: 70px;
display: block;
background: #e7e7e7;
border-radius: 35px;
border: 10px solid #ffffff;
box-shadow: inset 0 -7px 0 0 #d7d7d7;
position: absolute;
top: 90px;
left: 50px
}
.hari18 .awan18:before {
content: ''', ''';
width: 65px;
height: 35px;
display: block;
background: #e7e7e7;
border-radius: 35px 35px 0 0;
border: 10px solid #ffffff;
border-bottom: 0;
position: absolute;
top: -35px;
left: 20px
}
.hari18 .awan18.invert {
top: 60px;
left: 250px
}
.hari18 .awan18.invert:before {
left: 50px
}
.hari18 .sun {
width: 75px;
height: 75px;
display: block;
background: #fff297;
border-radius: 50%;
box-shadow: inset -5px -5px 0 0 #ddc991;
position: absolute;
top: 50px;
left: 0;
animation: sun_movement 7s infinite linear
}
.malam18 {
width: 100%;
height: 100%;
display: block;
position: absolute;
top: 0;
left: 0;
animation: run_malam18 7s infinite linear
}
.malam18 .bintang18 .star {
width: 5px;
height: 5px;
display: block;
background: #f7f7f7;
border-radius: 50%;
position: absolute
}
.malam18 .bintang18 .star:nth-child(1) {
top: 50px;
left: 50px
}
.malam18 .bintang18 .star:nth-child(2) {
top: 200px;
left: 70px
}
.malam18 .bintang18 .star:nth-child(3) {
top: 100px;
left: 300px
}
.malam18 .bintang18 .star:nth-child(4) {
top: 50px;
left: 220px
}
.malam18 .bintang18 .star:nth-child(5) {
top: 160px;
left: 320px
}
.malam18 .bintang18 .star:nth-child(6) {
top: 150px;
left: 230px
}
.malam18 .bintang18 .star:nth-child(7) {
top: 180px;
left: 400px
}
.malam18 .bintang18 .star:nth-child(8) {
top: 50px;
left: 360px
}
.malam18 .moon {
width: 75px;
height: 75px;
display: block;
background: #d7d7d7;
border-radius: 50%;
box-shadow: inset -5px -5px 0 0 #c7c7c7;
position: absolute;
top: 50px;
left: 100px;
animation: moon_movement 7s infinite linear
}
<script type="text/javascript" src="https://code.jquery.com/jquery-3.6.0.js"></script>
<link rel="stylesheet" href="css.css">
<!-- Start Ramdan -->
<div id='arlinapuasa2018'>
<div class="overflow-hid">
<div class='puasa18'>
<p>كل عام والأمة الأسلامية بخير</p>
<p><span class='ramadan2018'>رمضان كريم</span></p>
</div>
<div class='gunung18'></div>
<div class='gunung18 behind'></div>
<div class='hari18'>
<div class='awan18'></div>
<div class='awan18 invert'></div>
<div class='sun'></div>
</div>
<div class='malam18'>
<div class='bintang18'>
<div class='star'></div>
<div class='star'></div>
<div class='star'></div>
<div class='star'></div>
<div class='star'></div>
<div class='star'></div>
<div class='star'></div>
<div class='star'></div>
</div>
<div class='moon'></div>
</div>
</div>
<a class='close-popup' href='#' title='close'><i class='fa fa-times'></i></a>
</div>
<!-- End Ramdan -->
<!-- ramdan js -->
<script type='text/javascript'>
//<![CDATA[
// Ramadan
jQuery(function($) {
$(window).bind("load",function(){
$("#arlinapuasa2018").animate({top:"15%"},1e3),
$("a.close-popup").click(function(){
return $(this).parent().fadeOut(2e3),!2;
})
});
});
</script>
I hope someone here can help me with that .
I just want to be able to cloes tap In this design
You can add
$("#close-popup").click(function() {
$("#arlinapuasa2018").remove();
})
to your code.
and if you don't see the X check if your fontawesome tag works or just replace:
<a class='close-popup' href='#' title='close'><i class='fa fa-times'></i></a>`
with
<a class='close-popup' href='#' title='close'>X</a>`
Or add z-index: 1000; on #close-popup to put in the foreground.
I have a breathing button and 2 left and right arrow having animation from left to right and right to left. I need to sync the animation speed of both the left and right arrow with the breathing button.When button will expand need to move both right and left arrow forward towards button and vice versa. Here is the code below
html
<div class="floatleft arrow arrow-right animate-right-to-left">Message2</div>
<button id="breathing-button" class="floatleft">Breathing Button</button>
<div class="floatleft arrow arrow-left animate-left-to-right">Message1</div>
css
#breathing-button {
width: 270px;
padding: 20px;
border: 1px solid #d1d1d1;
animation: breathing 1s ease-out infinite normal;
font-size: 24px;
background: #5885cb;
color: #fff;
-webkit-font-smoothing: antialiased;
border-radius: 8px;
text-align: center;
}
#keyframes breathing {
0% {
-webkit-transform: scale(0.9);
-ms-transform: scale(0.9);
transform: scale(0.9);
}
25% {
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
60% {
-webkit-transform: scale(0.9);
-ms-transform: scale(0.9);
transform: scale(0.9);
}
100% {
-webkit-transform: scale(0.9);
-ms-transform: scale(0.9);
transform: scale(0.9);
}
}
.arrow {
position: relative;
font-size: 13px;
max-width: 100px;
background: #D94F1A;
height: 40px;
line-height: 40px;
text-align: center;
color: white;
visibility: hidden;
opacity: 0;
transition: visibility 0s, opacity 0.3s ease-in-out;
top: 15px;
}
.arrow {
visibility: visible;
opacity: 1;
}
.arrow.animate-left-to-right {
animation-name: move-left-to-right;
animation-duration: 1s;
animation-delay: 0.6s;
animation-iteration-count: infinite;
animation-direction: alternative;
}
.arrow.animate-right-to-left {
animation-name: move-right-to-left;
animation-duration: 1s;
animation-delay: 0.6s;
animation-iteration-count: infinite;
animation-direction: alternative;
}
#keyframes move-left-to-right {
0% {
transform: translateX(5%);
box-shadow: 3px 5px 5px rgba(0, 0, 0, 0.2);
}
50% {
transform: translateX(15%);
box-shadow: 3px 5px 5px rgba(0, 0, 0, 0.4);
}
100% {
transform: translateX(5%);
box-shadow: 3px 5px 5px rgba(0, 0, 0, 0.2);
}
}
#keyframes move-right-to-left {
0% {
transform: translateX(-5%);
box-shadow: -3px 5px 5px rgba(0, 0, 0, 0.2);
}
50% {
transform: translateX(-15%);
box-shadow: -3px 5px 5px rgba(0, 0, 0, 0.4);
}
100% {
transform: translateX(-5%);
box-shadow: -3px 5px 5px rgba(0, 0, 0, 0.2);
}
}
.arrow-right:after {
content: "";
position: absolute;
right: -20px;
top: 0;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
border-left: 20px solid #D94F1A;
}
/*left arrow*/
.arrow-left {
border-radius: 0 5px 5px 0;
}
.arrow-left:before {
content: "";
position: absolute;
left: -20px;
top: 0;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
border-right: 20px solid #D94F1A;
}
.floatleft{
float:left;
width:100px;
margin-left:10px;
margin-right:10px;
}
Changed breathing keyframes to this
#keyframes breathing {
0% {
-webkit-transform: scale(0.9);
-ms-transform: scale(0.9);
transform: scale(0.9);
}
50% {
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
100% {
-webkit-transform: scale(0.9);
-ms-transform: scale(0.9);
transform: scale(0.9);
}
}
Demo
Cleaned your code a little.
#breathing-button {
width: 270px;
padding: 20px;
border: 1px solid #d1d1d1;
animation: breathing 1s infinite forwards;
font-size: 24px;
background: #5885cb;
color: #fff;
-webkit-font-smoothing: antialiased;
border-radius: 8px;
text-align: center;
}
#keyframes breathing {
0% {
-webkit-transform: scale(0.9);
-ms-transform: scale(0.9);
transform: scale(0.9);
}
50% {
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
100% {
-webkit-transform: scale(0.9);
-ms-transform: scale(0.9);
transform: scale(0.9);
}
}
.arrow {
position: relative;
font-size: 13px;
max-width: 100px;
background: #D94F1A;
height: 40px;
line-height: 40px;
text-align: center;
color: white;
top: 15px;
}
.arrow.animate-left-to-right {
animation: move-left-to-right 1s infinite forwards;
}
.arrow.animate-right-to-left {
animation: move-right-to-left 1s infinite forwards;
}
#keyframes move-left-to-right {
0% {
transform: translateX(15%);
box-shadow: 3px 5px 5px rgba(0, 0, 0, 0.4);
}
50% {
transform: translateX(5%);
box-shadow: 3px 5px 5px rgba(0, 0, 0, 0.2);
}
100% {
transform: translateX(15%);
box-shadow: 3px 5px 5px rgba(0, 0, 0, 0.4);
}
}
#keyframes move-right-to-left {
0% {
transform: translateX(-15%);
box-shadow: -3px 5px 5px rgba(0, 0, 0, 0.4);
}
50% {
transform: translateX(-5%);
box-shadow: -3px 5px 5px rgba(0, 0, 0, 0.2);
}
100% {
transform: translateX(-15%);
box-shadow: -3px 5px 5px rgba(0, 0, 0, 0.4);
}
}
.arrow-right {
border-radius: 5px 0 0 5px;
}
.arrow-left {
border-radius: 0 5px 5px 0;
}
.arrow-right:after, .arrow-left:before {
content: "";
position: absolute;
top: 0;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
.arrow-right:after {
right: -20px;
border-left: 20px solid #D94F1A;
}
.arrow-left:before {
left: -20px;
border-right: 20px solid #D94F1A;
}
.floatleft {
float: left;
width: 100px;
margin-left: 10px;
margin-right: 10px;
}
I need these glowing bubbles to move around smoothly like galaxies in a universe.
There are four bubbles here just moving up, I can't seem to make them move in rounds like a galaxy scaling(1) from center and while moving to the right-top and going into deep space and decrease scaling(0.3) and while moving to the right direction, "something like that".
How do we do this in pure css?
The glowing bubbles code
body {
background: #26323e;
}
#keyframes greenPulse {
0% {
box-shadow: 0 0 30px #4bbec8
}
50% {
box-shadow: 0 0 80px #4bbec8
}
100% {
box-shadow: 0 0 30px #4bbec8
}
}
#-webkit-keyframes greenPulse {
0% {
-webkit-box-shadow: 0 0 30px #4bbec8
}
50% {
-webkit-box-shadow: 0 0 80px #4bbec8
}
100% {
-webkit-box-shadow: 0 0 30px #4bbec8
}
}
#-moz-keyframes greenPulse {
0% {
-moz-box-shadow: 0 0 30px #4bbec8
}
50% {
-moz-box-shadow: 0 0 80px #4bbec8
}
100% {
-moz-box-shadow: 0 0 30px #4bbec8
}
}
#-o-keyframes greenPulse {
0% {
-o-box-shadow: 0 0 30px #4bbec8
}
50% {
-o-box-shadow: 0 0 80px #4bbec8
}
100% {
-o-box-shadow: 0 0 30px #4bbec8
}
}
#keyframes bubbleUp {
0% {
bottom: 110px;
-webkit-transform: scale(.9);
opacity: 0
}
1% {
bottom: 110px;
-webkit-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-webkit-transform: scale(.8);
opacity: 1
}
95% {
bottom: 545px;
-webkit-transform: scale(.3);
opacity: 1
}
99% {
bottom: 550px;
-webkit-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-webkit-transform: scale(.9);
opacity: 0
}
}
#-webkit-keyframes bubbleUp {
0% {
bottom: 110px;
-webkit-transform: scale(.9);
opacity: 0
}
1% {
bottom: 110px;
-webkit-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-webkit-transform: scale(.8);
opacity: 1
}
95% {
bottom: 545px;
-webkit-transform: scale(.3);
opacity: 1
}
99% {
bottom: 550px;
-webkit-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-webkit-transform: scale(.9);
opacity: 0
}
}
#-moz-keyframes bubbleUp {
0% {
bottom: 110px;
-moz-transform: scale(.9);
opacity: 0
}
1% {
bottom: 110px;
-moz-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-moz-transform: scale(.8);
opacity: 1
}
95% {
bottom: 545px;
-moz-transform: scale(.3);
opacity: 1
}
99% {
bottom: 550px;
-moz-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-moz-transform: scale(.9);
opacity: 0
}
}
#-o-keyframes bubbleUp {
0% {
bottom: 110px;
-o-transform: scale(.9);
opacity: 0
}
1% {
bottom: 110px;
-o-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-o-transform: scale(.8);
opacity: 1
}
95% {
bottom: 545px;
-o-transform: scale(.3);
opacity: 1
}
99% {
bottom: 550px;
-o-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-o-transform: scale(.9);
opacity: 0
}
}
#keyframes bubbleUp1 {
0% {
bottom: 120px;
transform: scale(.3);
opacity: 0
}
1% {
bottom: 80px;
transform: scale(.2);
opacity: 0
}
30% {
bottom: 90px;
transform: scale(.2);
opacity: 1
}
95% {
bottom: 500px;
transform: scale(.4);
opacity: 1
}
99% {
bottom: 550px;
transform: scale(.2);
opacity: 0
}
100% {
bottom: 140px;
transform: scale(.9);
opacity: 0
}
}
#-webkit-keyframes bubbleUp1 {
0% {
bottom: 120px;
-webkit-transform: scale(.3);
opacity: 0
}
1% {
bottom: 80px;
-webkit-transform: scale(.2);
opacity: 0
}
30% {
bottom: 90px;
-webkit-transform: scale(.2);
opacity: 1
}
95% {
bottom: 500px;
-webkit-transform: scale(.4);
opacity: 1
}
99% {
bottom: 550px;
-webkit-transform: scale(.2);
opacity: 0
}
100% {
bottom: 140px;
-webkit-transform: scale(.9);
opacity: 0
}
}
#-moz-keyframes bubbleUp1 {
0% {
bottom: 120px;
-moz-transform: scale(.3);
opacity: 0
}
1% {
bottom: 80px;
-moz-transform: scale(.2);
opacity: 0
}
30% {
bottom: 90px;
-moz-transform: scale(.2);
opacity: 1
}
95% {
bottom: 500px;
-moz-transform: scale(.4);
opacity: 1
}
99% {
bottom: 550px;
-moz-transform: scale(.2);
opacity: 0
}
100% {
bottom: 140px;
-moz-transform: scale(.9);
opacity: 0
}
}
#-o-keyframes bubbleUp1 {
0% {
bottom: 120px;
-o-transform: scale(.3);
opacity: 0
}
1% {
bottom: 80px;
-o-transform: scale(.2);
opacity: 0
}
30% {
bottom: 90px;
-o-transform: scale(.2);
opacity: 1
}
95% {
bottom: 500px;
-o-transform: scale(.4);
opacity: 1
}
99% {
bottom: 550px;
-o-transform: scale(.2);
opacity: 0
}
100% {
bottom: 140px;
-o-transform: scale(.9);
opacity: 0
}
}
#keyframes bubbleUp2 {
0% {
bottom: 110px;
transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
transform: scale(.9);
opacity: 1
}
95% {
bottom: 650px;
transform: scale(.3);
opacity: 1
}
99% {
bottom: 655px;
transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
transform: scale(1);
opacity: 0
}
}
#-webkit-keyframes bubbleUp2 {
0% {
bottom: 110px;
-webkit-transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
-webkit-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-webkit-transform: scale(.9);
opacity: 1
}
95% {
bottom: 650px;
-webkit-transform: scale(.3);
opacity: 1
}
99% {
bottom: 655px;
-webkit-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-webkit-transform: scale(1);
opacity: 0
}
}
#-moz-keyframes bubbleUp2 {
0% {
bottom: 110px;
-moz-transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
-moz-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-moz-transform: scale(.9);
opacity: 1
}
95% {
bottom: 650px;
-moz-transform: scale(.3);
opacity: 1
}
99% {
bottom: 655px;
-moz-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-moz-transform: scale(1);
opacity: 0
}
}
#-o-keyframes bubbleUp2 {
0% {
bottom: 110px;
-o-transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
-o-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-o-transform: scale(.9);
opacity: 1
}
95% {
bottom: 650px;
-o-transform: scale(.3);
opacity: 1
}
99% {
bottom: 655px;
-o-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-o-transform: scale(1);
opacity: 0
}
}
#keyframes bubbleUp3 {
0% {
bottom: 110px;
transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
transform: scale(.9);
opacity: 1
}
95% {
bottom: 495px;
transform: scale(.3);
opacity: 1
}
99% {
bottom: 500px;
transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
transform: scale(1);
opacity: 0
}
}
#-webkit-keyframes bubbleUp3 {
0% {
bottom: 110px;
-webkit-transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
-webkit-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-webkit-transform: scale(.9);
opacity: 1
}
95% {
bottom: 495px;
-webkit-transform: scale(.3);
opacity: 1
}
99% {
bottom: 500px;
-webkit-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-webkit-transform: scale(1);
opacity: 0
}
}
#-moz-keyframes bubbleUp3 {
0% {
bottom: 110px;
-moz-transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
-moz-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-moz-transform: scale(.9);
opacity: 1
}
95% {
bottom: 495px;
-moz-transform: scale(.3);
opacity: 1
}
99% {
bottom: 500px;
-moz-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-moz-transform: scale(1);
opacity: 0
}
}
#-o-keyframes bubbleUp3 {
0% {
bottom: 110px;
-o-transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
-o-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-o-transform: scale(.9);
opacity: 1
}
95% {
bottom: 495px;
-o-transform: scale(.3);
opacity: 1
}
99% {
bottom: 500px;
-o-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-o-transform: scale(1);
opacity: 0
}
}
#keyframes bubbleUp4 {
0% {
bottom: 110px;
transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
transform: scale(.9);
opacity: 1
}
95% {
bottom: 595px;
transform: scale(.3);
opacity: 1
}
99% {
bottom: 600px;
transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
transform: scale(1);
opacity: 0
}
}
#-webkit-keyframes bubbleUp4 {
0% {
bottom: 110px;
-webkit-transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
-webkit-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-webkit-transform: scale(.9);
opacity: 1
}
95% {
bottom: 595px;
-webkit-transform: scale(.3);
opacity: 1
}
99% {
bottom: 600px;
-webkit-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-webkit-transform: scale(1);
opacity: 0
}
}
#-moz-keyframes bubbleUp4 {
0% {
bottom: 110px;
-moz-transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
-moz-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-moz-transform: scale(.9);
opacity: 1
}
95% {
bottom: 595px;
-moz-transform: scale(.3);
opacity: 1
}
99% {
bottom: 600px;
-moz-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-moz-transform: scale(1);
opacity: 0
}
}
#-o-keyframes bubbleUp4 {
0% {
bottom: 110px;
-o-transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
-o-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-o-transform: scale(.9);
opacity: 1
}
95% {
bottom: 595px;
-o-transform: scale(.3);
opacity: 1
}
99% {
bottom: 600px;
-o-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-o-transform: scale(1);
opacity: 0
}
}
div#beaker {
width: 300px;
height: 700px;
margin: 0 auto;
position: relative
}
div#beaker span.glow {
width: 100%;
height: 100%;
background: ##222;
position: relative;
display: block;
border-radius: 200px;
animation: greenPulse 2s infinite;
-webkit-animation: greenPulse 2s infinite;
-moz-animation: greenPulse 2s infinite;
-o-animation: greenPulse 2s infinite;
}
div#beaker span.bubble {
background: #fff;
width: 80px;
height: 80px;
position: absolute;
display: block;
left: 110px;
bottom: 110px;
border-radius: 100px;
background: -moz-radial-gradient(center 45deg, circle closest-corner, rgba(75, 190, 200, 0), rgba(75, 190, 200, .1), rgba(75, 190, 200, .3), rgba(255, 255, 255, .7));
background: -webkit-gradient(radial, center center, 0, center center, 100, from(rgba(75, 190, 200, .2)), to(rgba(255, 255, 255, .7)));
background: gradient(center 45deg, circle closest-corner, rgba(75, 190, 200, 0), rgba(75, 190, 200, .1), rgba(75, 190, 200, .3), rgba(255, 255, 255, .7));
background: -ms-radial-gradient(center, ellipse cover, rgba(255, 255, 255, 0) 0%, rgba(9, 133, 167, 0.1) 51%, rgba(9, 133, 167, 0.3) 71%, rgba(9, 133, 167, .7) 100%);
animation: bubbleUp 4s infinite ease-in-out;
-webkit-animation: bubbleUp 4s infinite ease-in-out;
-o-animation: bubbleUp 4s infinite ease-in-out;
-moz-animation: bubbleUp 4s infinite ease-in-out;
}
div#beaker span.bubble1 {
background: #fff;
width: 70px;
height: 70px;
position: absolute;
display: block;
left: 115px;
bottom: 110px;
border-radius: 80px;
background: -moz-radial-gradient(center 45deg, circle closest-corner, rgba(75, 190, 200, 0), rgba(75, 190, 200, .1), rgba(75, 190, 200, .3), rgba(255, 255, 255, .7));
background: -webkit-gradient(radial, center center, 0, center center, 100, from(rgba(75, 190, 200, .2)), to(rgba(255, 255, 255, .7)));
background: -ms-radial-gradient(center, ellipse cover, rgba(255, 255, 255, 0) 0%, rgba(9, 133, 167, 0.1) 51%, rgba(9, 133, 167, 0.3) 71%, rgba(9, 133, 167, .7) 100%);
animation: bubbleUp 5s infinite;
-webkit-animation: bubbleUp1 5s infinite;
-o-animation: bubbleUp1 5s infinite;
-moz-animation: bubbleUp1 5s infinite;
}
div#beaker span.bubble2 {
background: #fff;
width: 30px;
height: 30px;
position: absolute;
display: block;
left: 110px;
bottom: 110px;
border-radius: 60px;
background: -moz-radial-gradient(center 45deg, circle closest-corner, rgba(75, 190, 200, 0), rgba(75, 190, 200, .1), rgba(75, 190, 200, .3), rgba(255, 255, 255, .7));
background: -webkit-gradient(radial, center center, 0, center center, 100, from(rgba(75, 190, 200, .2)), to(rgba(255, 255, 255, .7)));
background: -ms-radial-gradient(center, ellipse cover, rgba(255, 255, 255, 0) 0%, rgba(9, 133, 167, 0.1) 51%, rgba(9, 133, 167, 0.3) 71%, rgba(9, 133, 167, .7) 100%);
animation: bubbleUp 7s infinite;
-webkit-animation: bubbleUp2 7s infinite;
-o-animation: bubbleUp2 7s infinite;
-moz-animation: bubbleUp2 7s infinite;
}
div#beaker span.bubble3 {
background: #fff;
width: 50px;
height: 50px;
position: absolute;
display: block;
left: 140px;
bottom: 95px;
border-radius: 100px;
background: -moz-radial-gradient(center 45deg, circle closest-corner, rgba(75, 190, 200, 0), rgba(75, 190, 200, .1), rgba(75, 190, 200, .3), rgba(255, 255, 255, .7));
background: -webkit-gradient(radial, center center, 0, center center, 100, from(rgba(75, 190, 200, .2)), to(rgba(255, 255, 255, .7)));
background: -ms-radial-gradient(center, ellipse cover, rgba(255, 255, 255, 0) 0%, rgba(9, 133, 167, 0.1) 51%, rgba(9, 133, 167, 0.3) 71%, rgba(9, 133, 167, .7) 100%);
animation: bubbleUp 10s infinite;
-webkit-animation: bubbleUp3 10s infinite;
-o-animation: bubbleUp3 10s infinite;
-moz-animation: bubbleUp3 10s infinite;
}
div#beaker span.bubble4 {
background: #fff;
width: 40px;
height: 40px;
position: absolute;
display: block;
left: 155px;
bottom: 110px;
border-radius: 100px;
background: -moz-radial-gradient(center 45deg, circle closest-corner, rgba(75, 190, 200, 0), rgba(75, 190, 200, .1), rgba(75, 190, 200, .3), rgba(255, 255, 255, .7));
background: -webkit-gradient(radial, center center, 0, center center, 100, from(rgba(75, 190, 200, .2)), to(rgba(255, 255, 255, .7)));
background: -ms-radial-gradient(center, ellipse cover, rgba(255, 255, 255, 0) 0%, rgba(9, 133, 167, 0.1) 51%, rgba(9, 133, 167, 0.3) 71%, rgba(9, 133, 167, .7) 100%);
animation: bubbleUp4 12s infinite;
-webkit-animation: bubbleUp4 12s infinite;
-o-animation: bubbleUp4 12s infinite;
-moz-animation: bubbleUp4 12s infinite;
}
<div id="lab">
<div id="beaker">
<span class="bubble"><span class="glow"></span></span>
<span class="bubble1"><span class="glow"></span></span>
<span class="bubble2"><span class="glow"></span></span>
<span class="bubble3"><span class="glow"></span></span>
<span class="bubble4"><span class="glow"></span></span>
</div>
</div>
My jsfiddle https://jsfiddle.net/pbged09z/
I just want to make a preloader that's positioned in the middle of the page.
Requirements:
position: fixed;
centered on the X-axis
It's just a div with class 'preloader' in body. Body is this div's direct parent, no other wrapper in between.
.preloader {
position: fixed;
display: inline-block;
z-index: 99;
top: 45%;
left: 50%;
width: 60px;
height: 60px;
-ms-transform: translateX(100px); /*100px just to test if it moved at all, initially had -50%, see list below*/
-webkit-transform: translateX(100px);
transform: translateX(100px);
//=====rest is just animation and aesthetics======
border: 3px solid #8A2EE6;
border-radius: 50%;
border-bottom: 3px solid black;
box-shadow: 0px 0px 20px 1px rgba(153, 102, 255, 0.5) inset, 0px 0px 20px 1px rgba(153, 102, 255, 0.5);
animation-name: rotatePreloader;
animation-duration: 0.65s;
animation-direction: normal;
animation-iteration-count: infinite;
animation-timing-function: linear;
transition: opacity 1s;
}
I've done:
display: block;
display: inline-block;
translateX(-50%);
translateX(30px);
translate(-50%, 0);
translate(30px, 0);
translate(-50%, -50%);
rearranging the transforms.. lol
took off -o & -mos
margin: 0 auto (worked with position: relative when I didn't need it to be fixed)
https://jsfiddle.net/goa3v2ke/#
You need to do like this, where you set top/left to 50% and then move them back with translate using the same value, int this case -50%.
Sample 1 now center it both horizontal and vertical, and by change the top/left values, you can move it in the direction you want, sample 2 has 33% as top value.
Update based on question edit
The small X/Y-axis offset is caused by the rotate being executed before the translate, so change your #keyframes rule to this, showed in sample 3 and an update of your fiddle
#keyframes rotatePreloader {
0% {
transform: translate(-50%, -50%) rotate(0deg);
}
100% {
transform: translate(-50%, -50%) rotate(360deg);
}
}
Sample 1
.preloader {
position: fixed;
display: inline-block;
z-index: 99;
top: 50%;
left: 50%;
width: 60px;
height: 60px;
transform: translate(-50%,-50%);
/*=====rest is just animation and aesthetics======*/
border: 3px solid #8A2EE6;
border-radius: 50%;
border-bottom: 3px solid black;
box-shadow: 0px 0px 20px 1px rgba(153, 102, 255, 0.5) inset, 0px 0px 20px 1px rgba(153, 102, 255, 0.5);
animation-name: rotatePreloader;
animation-duration: 0.65s;
animation-direction: normal;
animation-iteration-count: infinite;
animation-timing-function: linear;
transition: opacity 1s;
}
<div class="preloader"></div>
Sample 2
.preloader {
position: fixed;
display: inline-block;
z-index: 99;
top: 33%;
left: 50%;
width: 60px;
height: 60px;
transform: translate(-50%,-50%);
/*=====rest is just animation and aesthetics======*/
border: 3px solid #8A2EE6;
border-radius: 50%;
border-bottom: 3px solid black;
box-shadow: 0px 0px 20px 1px rgba(153, 102, 255, 0.5) inset, 0px 0px 20px 1px rgba(153, 102, 255, 0.5);
animation-name: rotatePreloader;
animation-duration: 0.65s;
animation-direction: normal;
animation-iteration-count: infinite;
animation-timing-function: linear;
transition: opacity 1s;
}
<div class="preloader"></div>
Sample 3
.leftPreloaderBG {
position: fixed;
background-color: black;
width: 50%;
height: 100%;
z-index: 98;
top: 0px;
left: 0px;
transition: width 1s;
}
.leftPreloaderBG.loaded {
width: 0;
}
.rightPreloaderBG {
position: fixed;
background-color: black;
width: 50%;
height: 100%;
z-index: 98;
top: 0px;
right: 0px;
transition: width 1s;
}
.rightPreloaderBG.loaded {
width: 0;
}
#keyframes rotatePreloader {
0% {
transform: translate(-50%, -50%) rotate(0deg);
}
100% {
transform: translate(-50%, -50%) rotate(360deg);
}
}
.preloader {
position: fixed;
display: inline-block;
z-index: 99;
top: 33%;
left: 50%;
width: 60px;
height: 60px;
transform: translate(-50%, -50%);
/*=====rest is just animation and aesthetics======*/
border: 3px solid #8A2EE6;
border-radius: 50%;
border-bottom: 3px solid black;
box-shadow: 0px 0px 20px 1px rgba(153, 102, 255, 0.5) inset, 0px 0px 20px 1px rgba(153, 102, 255, 0.5);
animation-name: rotatePreloader;
animation-duration: 0.65s;
animation-direction: normal;
animation-iteration-count: infinite;
animation-timing-function: linear;
transition: opacity 1s;
}
.preloader.loaded {
opacity: 0;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
margin: 0;
padding: 0;
width: 100%;
color: white;
font-size: 1em;
background-color: gray;
background-position: center;
background-repeat: repeat;
}
<body>
<div class="preloader"></div>
<div class="leftPreloaderBG"></div>
<div class="rightPreloaderBG"></div>
</body>
It is because you override the transform translate value in the keyframe animation. Try it like this:
.leftPreloaderBG {
position: fixed;
background-color: black;
width: 50%;
height: 100%;
z-index: 98;
top: 0px;
left: 0px;
transition: width 1s;
}
.leftPreloaderBG.loaded {
width: 0;
}
.rightPreloaderBG {
position: fixed;
background-color: black;
width: 50%;
height: 100%;
z-index: 98;
top: 0px;
right: 0px;
transition: width 1s;
}
.rightPreloaderBG.loaded {
width: 0;
}
#keyframes rotatePreloader {
0% {
transform: translate(-50%, -50%) rotate(0deg);
}
100% {
transform: translate(-50%, -50%) rotate(360deg);
}
}
.preloader {
position: fixed;
display: inline-block;
z-index: 99;
top: 33%;
left: 50%;
width: 60px;
height: 60px;
transform: translate(-50%, -50%);
/*=====rest is just animation and aesthetics======*/
border: 3px solid #8A2EE6;
border-radius: 50%;
border-bottom: 3px solid black;
box-shadow: 0px 0px 20px 1px rgba(153, 102, 255, 0.5) inset, 0px 0px 20px 1px rgba(153, 102, 255, 0.5);
animation-name: rotatePreloader;
animation-duration: 0.65s;
animation-direction: normal;
animation-iteration-count: infinite;
animation-timing-function: linear;
transition: opacity 1s;
}
.preloader.loaded {
opacity: 0;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
margin: 0;
padding: 0;
width: 100%;
color: white;
font-size: 1em;
background-color: gray;
background-position: center;
background-repeat: repeat;
}
<body>
<div class="preloader"></div>
<div class="leftPreloaderBG"></div>
<div class="rightPreloaderBG"></div>
</body>
This is a css
#loading {
margin: 80px auto;
position: relative;
width: 100px;
height: 100px;
-webkit-border-radius: 50px;
-moz-border-radius: 50px;
border-radius: 50px;
background: #ccc;
font: 12px "Lucida Grande", Sans-Serif;
text-align: center;
line-height: 100px;
color: white;
-webkit-box-shadow: 0 0 5px rgba(0,0,0,0.5);
-moz-box-shadow: 0 0 5px rgba(0,0,0,0.5);
box-shadow: 0 0 5px rgba(0,0,0,0.5);
}
#loading:before {
content: "";
position: absolute;
left: -20px;
top: -20px;
bottom: -20px;
right: -20px;
-webkit-border-radius: 70px;
-moz-border-radius: 70px;
border-radius: 70px;
background: #eee;
z-index: -2;
-webkit-box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
-moz-box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
}
#loading span {
position: absolute;
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-top: 80px solid rgba(255,255,255,0.7);
z-index: -1;
top: -28px;
left: 0px;
-webkit-animation: ticktock 5s linear infinite;
-moz-animation: ticktock 5s linear infinite;
animation:ticktock 5s linear infinite;
-webkit-transform-origin: 50px 80px;
-moz-transform-origin: 50px 80px;
transform-origin:50px 80px;
}
#loading strong {
overflow: hidden;
display: block;
margin: 0 auto;
-webkit-animation: expand 2.5s linear infinite;
-moz-animation: expand 2.5s linear infinite;
animation:expand 2.5s linear infinite;
}
#-webkit-keyframes expand {
0% {
width: 0;
}
100% {
width: 60px;
}
}
#-webkit-keyframes ticktock {
0% {
-webkit-transform: rotate(0);
-ms-transform: rotate(0);
transform: rotate(0);
-moz-transform: rotate(0);
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
-moz-transform: rotate(360deg);
}
}
#-moz-keyframes expand {
0% {
width: 0;
}
100% {
width: 60px;
}
}
#-moz-keyframes ticktock {
0% {
-webkit-transform: rotate(0);
-ms-transform: rotate(0);
transform: rotate(0);
-moz-transform: rotate(0);
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
-moz-transform: rotate(360deg);
}
}
#keyframes ticktock {
0% {
-webkit-transform: rotate(0);
-ms-transform: rotate(0);
transform: rotate(0);
-moz-transform: rotate(0);
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform:rotate(360deg);
-moz-transform: rotate(360deg);
}
}
#keyframes expand {
0% {
width: 0;
}
100% {
width: 60px;
}
}
this is the html
<div id="loading"><strong>loading...</strong><span></span></div>
The problem that this is the result
http://jsfiddle.net/jtrax/
It is working good and the circle is rotating
But when I add a completely separate css the circle is disappear, this is a jfiddle after adding the css which is not related to the circle
http://jsfiddle.net/HSJ3j/
Before adding the unrelated css:
After adding the unrelated css:
I forgot to tell you that the wrong is happening in the span in the html
Edit
when I change the z of loading span to 1 and the z of #loading:before to 0, I got this result
I restructured your loading div so it makes more sense and easier to understand
http://jsfiddle.net/jtrax/1/
<div id="loading">
<span></span>
<div class="inner"><strong>loading...</strong></div>
</div>
You can check the css in the fiddle. The spinning span might need more adjustment to centre it but you get the idea
UPDATED fiddle:
http://jsfiddle.net/HSJ3j/3/
If you look at the stacking order, the loading text should be the highest, then the grey smaller circle, then the spinning span and finally the outer bigger circle. Construct your div according to that and it makes things much easier
It's just an arrangement issue.
Your fieldset tag is over your animation. Try to arrange your fieldset to be styled with z-index:-1;.