Removing an element from the CSS file - javascript

I want to remove a small button/element that is under my preloader. I am trying to figure out exactly what kind of css file controls that but I am unable to remove that element under the preloader. I thought adding overflow:hidden to the svg would do the trick but it still did not.
This is the code of the preloader:
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
#import url('https://fonts.googleapis.com/css2?family=Montserrat+Alternates:wght#500;700&family=Montserrat:wght#400;600&family=Oswald:wght#500&family=Pacifico&family=Roboto:ital,wght#0,400;0,900;1,500&display=swap');
.svg-file path {
fill: transparent;
stroke-width: 3;
stroke: rgb(1, 36, 133);
}
.svg-file.z-logo path {
stroke-dasharray: 550;
stroke-dashoffset: 0;
}
.svg-file.z-logo path {
animation: animate-zlogo 2s linear infinite;
}
svg {
filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 1));
transform: scale(2);
}
.svg-file h2 {
font-family: "Roboto", cursive;
transform: translate(0, 50px) skewX(-210deg) rotate(-6deg);
font-size: 3em;
color: #044d77;
}
.svg-file span {
animation: dots 2.5s steps(6, end) infinite;
font-size: 5em;
display: block;
transform: translate(0, 65px) skewX(-210deg) rotate(-6deg);
background-color: rgb(5, 46, 80);
width: 8px;
height: 5px;
}
#keyframes fadein-fadeout {
0% {
opacity: 0;
}
50% {
opacity: 1;
}
100% {
opacity: 0;
}
}
#keyframes animate-zlogo {
0% {
stroke-dashoffset: -50;
}
20% {
stroke-dashoffset: 550;
fill: transparent;
}
40% {
fill: transparent;
stroke-dashoffset: 1100;
}
60% {
stroke-dashoffset: 1100;
fill: #05f7f9;
}
80% {
stroke-width: 0;
fill: #05f7f9;
}
100% {
/* stroke-dashoffset: 0; */
stroke-width: 3;
fill: transparent;
}
}
#preloader {
position: absolute;
margin: auto;
z-index: 9999;
overflow: hidden;
background: white;
display: flex;
justify-content: center;
align-items: center;
align-content: center;
top: 0px;
left: 0px;
bottom: 0px;
right: 0px;
}
.z-logo svg {
top: 0px;
left: 0px;
bottom: 0px;
right: 0px;
margin: auto;
justify-content: center;
align-items: center;
align-content: center;
position: relative;
display: flex;
width: 50%;
}
.z-logo::before {
content: "";
top: 0px;
left: 0px;
bottom: 0px;
right: 0px;
margin: auto;
background: black;
position: absolute;
display: inline-flex;
border: 1px solid black;
width: 200px;
height: 200px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="preloader">
<div class="svg-file z-logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 133 133" width="133" height="133">
<g id="H">
<path d="M45.33 78.22L87.67 78.22L87.67 133L121.05 133L121.05 0L87.67 0L87.67 49.33L45.33 49.33L45.33 0L11.95 0L11.95 133L45.33 133L45.33 78.22Z" fill="#47AF9A" />
</g>
</svg>
<span></span>
</div>
</div>
This is the element I want to remove under my preloader:

Just remove <span></span> from your HTML code.
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
#import url('https://fonts.googleapis.com/css2?family=Montserrat+Alternates:wght#500;700&family=Montserrat:wght#400;600&family=Oswald:wght#500&family=Pacifico&family=Roboto:ital,wght#0,400;0,900;1,500&display=swap');
.svg-file path {
fill: transparent;
stroke-width: 3;
stroke: rgb(1, 36, 133);
}
.svg-file.z-logo path {
stroke-dasharray: 550;
stroke-dashoffset: 0;
}
.svg-file.z-logo path {
animation: animate-zlogo 2s linear infinite;
}
svg {
filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 1));
transform: scale(2);
}
.svg-file h2 {
font-family: "Roboto", cursive;
transform: translate(0, 50px) skewX(-210deg) rotate(-6deg);
font-size: 3em;
color: #044d77;
}
.svg-file span {
animation: dots 2.5s steps(6, end) infinite;
font-size: 5em;
display: block;
transform: translate(0, 65px) skewX(-210deg) rotate(-6deg);
background-color: rgb(5, 46, 80);
width: 8px;
height: 5px;
}
#keyframes fadein-fadeout {
0% {
opacity: 0;
}
50% {
opacity: 1;
}
100% {
opacity: 0;
}
}
#keyframes animate-zlogo {
0% {
stroke-dashoffset: -50;
}
20% {
stroke-dashoffset: 550;
fill: transparent;
}
40% {
fill: transparent;
stroke-dashoffset: 1100;
}
60% {
stroke-dashoffset: 1100;
fill: #05f7f9;
}
80% {
stroke-width: 0;
fill: #05f7f9;
}
100% {
/* stroke-dashoffset: 0; */
stroke-width: 3;
fill: transparent;
}
}
#preloader {
position: absolute;
margin: auto;
z-index: 9999;
overflow: hidden;
background: white;
display: flex;
justify-content: center;
align-items: center;
align-content: center;
top: 0px;
left: 0px;
bottom: 0px;
right: 0px;
}
.z-logo svg {
top: 0px;
left: 0px;
bottom: 0px;
right: 0px;
margin: auto;
justify-content: center;
align-items: center;
align-content: center;
position: relative;
display: flex;
width: 50%;
}
.z-logo::before {
content: "";
top: 0px;
left: 0px;
bottom: 0px;
right: 0px;
margin: auto;
background: black;
position: absolute;
display: inline-flex;
border: 1px solid black;
width: 200px;
height: 200px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="preloader">
<div class="svg-file z-logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 133 133" width="133" height="133">
<g id="H">
<path d="M45.33 78.22L87.67 78.22L87.67 133L121.05 133L121.05 0L87.67 0L87.67 49.33L45.33 49.33L45.33 0L11.95 0L11.95 133L45.33 133L45.33 78.22Z" fill="#47AF9A" />
</g>
</svg>
</div>
</div>

Related

Using JavaScript to do something after you scroll an amount of pixels doesn't work

I followed this tutorial here and edited it a little bit to change it to this:
<script lang="text/javascript">
// When the user scrolls down 50px from the top of the document, resize the header's font size
window.onscroll = function () {
scrollFunction()
};
function scrollFunction() {
if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) {
document.getElementById("header").style.display = "block";
} else {
document.getElementById("header").style.display = "none";
}
}
</script>
With the header HTML being:
<div style="display: none;" id="header">Header</div>
When I try this in my .html file it will not work and doesn't even say a log in the console if I ask it to. I created a new HTML file with no reference to my CSS file and that worked so I think it is something to do with that, I don't know what though. Here is my CSS:
* {
box-sizing: border-box;
}
body {
/*Want to change background image?*/
/*Upload a new one to the img folder.*/
/*Make sure you name it 'minecraft.jpg'*/
background: linear-gradient(rgba(20, 26, 35, 0.55), rgba(20, 26, 35, 0.55)),
url("../img/background.jpg") no-repeat center center fixed;
background-size: cover;
font-family: "Open Sans", Helvetica;
margin: 0;
position: relative;
}
#header {
background-color: #f1f1f1; /* Grey background */
padding: 50px 10px; /* Some padding */
color: black;
text-align: center; /* Centered text */
font-size: 90px; /* Big font size */
font-weight: bold;
position: fixed; /* Fixed position - sit on top of the page */
top: 0;
width: 100%; /* Full width */
transition: 0.2s; /* Add a transition effect (when scrolling - and font size is decreased) */
}
html,
body {
width: 100vw;
height: 100vh;
overflow-x: hidden;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
scroll-behavior: smooth;
}
a {
text-decoration: none;
/* color: rgb(0, 0, 0); */
}
.a-contact {
text-decoration: underline !important;
color: black;
}
.a-contact:hover {
color: rgb(236, 149, 35);
transition: all 0.3s ease-in;
}
p {
margin: 0;
padding: 3px;
}
.container {
text-align: center;
}
.logo img {
width: 225px;
/* Change image size for mobile */
-webkit-animation-name: logo;
animation-name: logo;
-webkit-animation-duration: 5s;
animation-duration: 5s;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out;
}
#-webkit-keyframes logo {
0% {
-webkit-transform: scale(1);
transform: scale(1);
}
50% {
-webkit-transform: scale(1.07);
transform: scale(1.07);
}
100% {
-webkit-transform: scale(1);
transform: scale(1);
}
}
#keyframes logo {
0% {
-webkit-transform: scale(1);
transform: scale(1);
}
50% {
-webkit-transform: scale(1.07);
transform: scale(1.07);
}
100% {
-webkit-transform: scale(1);
transform: scale(1);
}
}
.playercount {
display: inline-block;
margin: 20px 15px 0 15px;
padding: 2px 0;
background-color: rgba(15, 199, 209, 0.75);
font-size: 1em;
color: white;
text-align: center;
border-radius: 5px 0 5px 0;
line-height: 27px;
}
.playercount>p>span {
font-weight: bold;
padding: 1px 4px;
border-radius: 3px;
background: rgba(9, 150, 158, 0.7);
margin: 0 2px;
}
.extrapad {
padding: 0;
}
.ip {
cursor: pointer;
}
.items {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-pack: distribute;
justify-content: space-around;
-ms-flex-preferred-size: 100px;
flex-basis: 100px;
padding: 18px 0 10px 0;
}
.item img {
-webkit-transition: all 0.2s ease;
-o-transition: all 0.2s ease;
transition: all 0.2s ease;
margin-bottom: 7px;
}
.item img:hover {
-webkit-transform: scale(1.1);
-ms-transform: scale(1.1);
transform: scale(1.1);
}
.img {
width: 80%;
}
.title {
font-weight: bold;
font-size: 17px;
color: white;
}
.subtitle {
color: #cfcfcf;
font-size: 12px;
}
.title,
.subtitle {
margin: 0;
padding: 0;
}
#media(min-width: 400px) {
.logo img {
width: 280px;
/* Change image size for mid sized devices */
}
.playercount {
margin-top: 30px;
padding: 5px;
}
.playercount>p>span {
padding: 2px 7px;
}
}
#media(min-width: 1250px) {
.title {
font-size: 24px;
}
.subtitle {
font-size: 15px;
}
.logo img {
width: 470px;
/* Change image size for desktop */
}
.logo {
margin-bottom: 28px;
}
.img {
width: 100%;
}
.items {
padding: 30px 0 20px 0;
}
.playercount {
font-size: 1.22em;
padding: 10px;
}
.extrapad {
padding: 0 42.5px;
}
.playercount>p>span {
padding: 4px 7px;
}
}
#media(min-width: 1000px) {
.items {
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
}
.item:not(:first-child) {
margin-left: 90px;
}
}
.footer {
position: absolute;
color: white;
margin-left: 5px;
top: 98%;
left: 0;
position: fixed;
z-index: 1;
}
.background {
/* background-color: rgb(187, 156, 53); */
background: linear-gradient(0deg, rgb(255, 136, 0, 0.781), rgba(0, 0, 0, 0));
width: 100%;
position: absolute;
top: 110%;
height: 50%;
}
.background-white {
/* background-color: rgb(187, 156, 53); */
background: linear-gradient(0deg, rgba(255, 255, 255, 0.781), rgba(0, 0, 0, 0));
width: 100%;
position: absolute;
top: 220%;
height: 50%;
}
.background-opposite {
/* background-color: rgb(187, 156, 53); */
background: linear-gradient(rgb(255, 136, 0, 0.781), rgba(0, 0, 0, 0));
width: 100%;
position: absolute;
top: 200%;
height: 50%;
}
.background-white-opposite {
/* background-color: rgb(187, 156, 53); */
background: linear-gradient(rgba(255, 255, 255, 0.781), rgba(0, 0, 0, 0));
width: 100%;
position: absolute;
top: 310%;
height: 50%;
}
.inner {
background-color: rgba(255, 136, 0, 0.781);
height: 40%;
top: 160%;
width: 100%;
position: absolute;
}
.inner-white {
background-color: rgba(255, 255, 255, 0.781);
height: 40%;
top: 270%;
width: 100%;
position: absolute;
}
/* .inner-text {
text-align: center;
} */
.inner-text-head {
padding-top: 20px;
font-size: 55px;
text-align: center;
}
.inner-text-white-head {
padding-top: 20px;
font-size: 55px;
text-align: center;
}
.inner-text-white-h2 {
font-size: 35px;
text-align: center;
}
.contact-area {
padding: 20px;
border-radius: 5px;
background-color: rgb(255, 255, 255);
border-color: black;
border-style: dashed;
border-width: 5px;
width: 50% !important;
left: 25% !important;
position: relative;
z-index: 2;
}
.inner-text-p {
width: 75%;
left: 13%;
text-align: center;
position: relative;
font-size: 20px;
color: black;
}
.inner-white-text-p {
width: 75%;
left: 13%;
text-align: center;
position: relative;
font-size: 20px;
color: black;
}
.solved {
color: orange !important;
font-weight: bold;
}
.italic {
font-style: italic;
}
/* Scroll Down */
#s-scroll {
position: relative;
width: 24px;
height: 24px;
}
.chevroncontainer {
position: absolute;
/* margin-left: auto;
margin-right: auto; */
top: 30%;
/* right: 50%; */
/* left: 50%; */
/* top: 30%;
left: -30%; */
}
.chevron {
position: absolute;
width: 38px;
height: 30px;
/* width: 56px;
height: 36px; */
opacity: 0;
transform: scale3d(0.5, 0.5, 0.5);
animation: move 0.2s ease-out infinite;
animation-play-state: paused;
animation-delay: calc(var(--scroll) * -1s);
margin-left: -18px;
}
/* .chevroncontainer {
position: absolute;
bottom: 100px !important;
} */
.chevron:first-child {
animation: move 0.2s ease-out 0.2s infinite;
animation-play-state: paused;
animation-delay: calc(var(--scroll) * -1s);
}
.chevron:nth-child(2) {
animation: move 0.2s ease-out 0.2s infinite;
animation-play-state: paused;
animation-delay: calc(var(--scroll) * -1s);
}
/* CHEVRON CHANGED */
.changedchevron {
position: absolute;
width: 38px;
height: 30px;
/* width: 56px;
height: 36px; */
opacity: 0;
transform: scale3d(0.5, 0.5, 0.5);
animation: move 2s ease-out infinite;
/* margin-left: -538px; */
margin-left: -678px;
}
.changedchevronNO {
position: absolute;
width: 38px;
height: 30px;
/* width: 56px;
height: 36px; */
opacity: 0;
transform: scale3d(0.5, 0.5, 0.5);
animation: move 2s ease-out 1;
margin-left: -18px;
}
/* .changedchevron:first-child {
animation: move 2s ease-out 0.2s infinite;
}
.changedchevron:nth-child(2) {
animation: move 2s ease-out 0.2s infinite;
} */
.changedchevron:before,
.changedchevron:after {
content: ' ';
position: absolute;
top: 0;
height: 40%;
height: 40%;
width: 51%;
background: #fff;
}
.changedchevron:before {
left: 0;
transform: skew(0deg, 30deg);
}
.changedchevron:after {
right: 0;
width: 50%;
transform: skew(0deg, -30deg);
}
/* CHEVRON CHANGED END */
.chevron:before,
.chevron:after {
content: ' ';
position: absolute;
top: 0;
height: 100%;
height: 40%;
width: 51%;
background: #fff;
}
.chevron:before {
left: 0;
transform: skew(0deg, 30deg);
}
.chevron:after {
right: 0;
width: 50%;
transform: skew(0deg, -30deg);
}
#keyframes move {
25% {
opacity: 1;
}
33% {
opacity: 1;
transform: translateY(30px);
}
67% {
opacity: 1;
transform: translateY(40px);
}
100% {
opacity: 0;
transform: translateY(55px) scale3d(0.5, 0.5, 0.5);
}
}
.text {
display: block;
margin-top: 75px;
margin-left: -30px;
font-family: "Helvetica Neue", "Helvetica", Arial, sans-serif;
font-size: 17px;
color: #fff !important;
text-transform: uppercase;
white-space: nowrap;
opacity: .25;
animation: pulse 2s linear alternate infinite;
/* margin-left: -60px !important; */
cursor: pointer !important;
/* margin-left: -1058px; */
margin-left: -1338px;
}
#keyframes pulse {
to {
opacity: 1;
}
}
I'm sorry if this doesn't make any sense, I can't wrap my head around this problem either! Please tell me if you need more information and I can provide it.
Thanks!
I noticed 2 things:
Rather than window you may want document.body - I'm sure you'd rather scroll body and not the entire window
Rather than .onscroll you may want .addEventListener - Attaching JavaScript Handlers to Scroll Events — a how-NOT-to
Check out this snippet where I made those changes. I also made sure scrolling within a div wouldn't affect scrolling on document.body
document.body.addEventListener('scroll', function() {
scrollFunction()
})
// When the user scrolls down 50px from the top of the document, resize the header's font size
function scrollFunction() {
if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) {
document.getElementById("header").style.display = "block";
} else {
document.getElementById("header").style.display = "none";
}
}
* {
box-sizing: border-box;
}
body {
/*Want to change background image?*/
/*Upload a new one to the img folder.*/
/*Make sure you name it 'minecraft.jpg'*/
background: linear-gradient(rgba(20, 26, 35, 0.55), rgba(20, 26, 35, 0.55)),
url("../img/background.jpg") no-repeat center center fixed;
background-size: cover;
font-family: "Open Sans", Helvetica;
margin: 0;
position: relative;
}
#header {
background-color: #f1f1f1; /* Grey background */
padding: 50px 10px; /* Some padding */
color: black;
text-align: center; /* Centered text */
font-size: 90px; /* Big font size */
font-weight: bold;
position: fixed; /* Fixed position - sit on top of the page */
top: 0;
width: 100%; /* Full width */
transition: 0.2s; /* Add a transition effect (when scrolling - and font size is decreased) */
}
html,
body {
width: 100vw;
height: 100vh;
overflow-x: hidden;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
scroll-behavior: smooth;
}
a {
text-decoration: none;
/* color: rgb(0, 0, 0); */
}
.a-contact {
text-decoration: underline !important;
color: black;
}
.a-contact:hover {
color: rgb(236, 149, 35);
transition: all 0.3s ease-in;
}
p {
margin: 0;
padding: 3px;
}
.container {
text-align: center;
}
.logo img {
width: 225px;
/* Change image size for mobile */
-webkit-animation-name: logo;
animation-name: logo;
-webkit-animation-duration: 5s;
animation-duration: 5s;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out;
}
#-webkit-keyframes logo {
0% {
-webkit-transform: scale(1);
transform: scale(1);
}
50% {
-webkit-transform: scale(1.07);
transform: scale(1.07);
}
100% {
-webkit-transform: scale(1);
transform: scale(1);
}
}
#keyframes logo {
0% {
-webkit-transform: scale(1);
transform: scale(1);
}
50% {
-webkit-transform: scale(1.07);
transform: scale(1.07);
}
100% {
-webkit-transform: scale(1);
transform: scale(1);
}
}
.playercount {
display: inline-block;
margin: 20px 15px 0 15px;
padding: 2px 0;
background-color: rgba(15, 199, 209, 0.75);
font-size: 1em;
color: white;
text-align: center;
border-radius: 5px 0 5px 0;
line-height: 27px;
}
.playercount>p>span {
font-weight: bold;
padding: 1px 4px;
border-radius: 3px;
background: rgba(9, 150, 158, 0.7);
margin: 0 2px;
}
.extrapad {
padding: 0;
}
.ip {
cursor: pointer;
}
.items {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-pack: distribute;
justify-content: space-around;
-ms-flex-preferred-size: 100px;
flex-basis: 100px;
padding: 18px 0 10px 0;
}
.item img {
-webkit-transition: all 0.2s ease;
-o-transition: all 0.2s ease;
transition: all 0.2s ease;
margin-bottom: 7px;
}
.item img:hover {
-webkit-transform: scale(1.1);
-ms-transform: scale(1.1);
transform: scale(1.1);
}
.img {
width: 80%;
}
.title {
font-weight: bold;
font-size: 17px;
color: white;
}
.subtitle {
color: #cfcfcf;
font-size: 12px;
}
.title,
.subtitle {
margin: 0;
padding: 0;
}
#media(min-width: 400px) {
.logo img {
width: 280px;
/* Change image size for mid sized devices */
}
.playercount {
margin-top: 30px;
padding: 5px;
}
.playercount>p>span {
padding: 2px 7px;
}
}
#media(min-width: 1250px) {
.title {
font-size: 24px;
}
.subtitle {
font-size: 15px;
}
.logo img {
width: 470px;
/* Change image size for desktop */
}
.logo {
margin-bottom: 28px;
}
.img {
width: 100%;
}
.items {
padding: 30px 0 20px 0;
}
.playercount {
font-size: 1.22em;
padding: 10px;
}
.extrapad {
padding: 0 42.5px;
}
.playercount>p>span {
padding: 4px 7px;
}
}
#media(min-width: 1000px) {
.items {
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
}
.item:not(:first-child) {
margin-left: 90px;
}
}
.footer {
position: absolute;
color: white;
margin-left: 5px;
top: 98%;
left: 0;
position: fixed;
z-index: 1;
}
.background {
/* background-color: rgb(187, 156, 53); */
background: linear-gradient(0deg, rgb(255, 136, 0, 0.781), rgba(0, 0, 0, 0));
width: 100%;
position: absolute;
top: 110%;
height: 50%;
}
.background-white {
/* background-color: rgb(187, 156, 53); */
background: linear-gradient(0deg, rgba(255, 255, 255, 0.781), rgba(0, 0, 0, 0));
width: 100%;
position: absolute;
top: 220%;
height: 50%;
}
.background-opposite {
/* background-color: rgb(187, 156, 53); */
background: linear-gradient(rgb(255, 136, 0, 0.781), rgba(0, 0, 0, 0));
width: 100%;
position: absolute;
top: 200%;
height: 50%;
}
.background-white-opposite {
/* background-color: rgb(187, 156, 53); */
background: linear-gradient(rgba(255, 255, 255, 0.781), rgba(0, 0, 0, 0));
width: 100%;
position: absolute;
top: 310%;
height: 50%;
}
.inner {
background-color: rgba(255, 136, 0, 0.781);
height: 40%;
top: 160%;
width: 100%;
position: absolute;
}
.inner-white {
background-color: rgba(255, 255, 255, 0.781);
height: 40%;
top: 270%;
width: 100%;
position: absolute;
}
/* .inner-text {
text-align: center;
} */
.inner-text-head {
padding-top: 20px;
font-size: 55px;
text-align: center;
}
.inner-text-white-head {
padding-top: 20px;
font-size: 55px;
text-align: center;
}
.inner-text-white-h2 {
font-size: 35px;
text-align: center;
}
.contact-area {
padding: 20px;
border-radius: 5px;
background-color: rgb(255, 255, 255);
border-color: black;
border-style: dashed;
border-width: 5px;
width: 50% !important;
left: 25% !important;
position: relative;
z-index: 2;
}
.inner-text-p {
width: 75%;
left: 13%;
text-align: center;
position: relative;
font-size: 20px;
color: black;
}
.inner-white-text-p {
width: 75%;
left: 13%;
text-align: center;
position: relative;
font-size: 20px;
color: black;
}
.solved {
color: orange !important;
font-weight: bold;
}
.italic {
font-style: italic;
}
/* Scroll Down */
#s-scroll {
position: relative;
width: 24px;
height: 24px;
}
.chevroncontainer {
position: absolute;
/* margin-left: auto;
margin-right: auto; */
top: 30%;
/* right: 50%; */
/* left: 50%; */
/* top: 30%;
left: -30%; */
}
.chevron {
position: absolute;
width: 38px;
height: 30px;
/* width: 56px;
height: 36px; */
opacity: 0;
transform: scale3d(0.5, 0.5, 0.5);
animation: move 0.2s ease-out infinite;
animation-play-state: paused;
animation-delay: calc(var(--scroll) * -1s);
margin-left: -18px;
}
/* .chevroncontainer {
position: absolute;
bottom: 100px !important;
} */
.chevron:first-child {
animation: move 0.2s ease-out 0.2s infinite;
animation-play-state: paused;
animation-delay: calc(var(--scroll) * -1s);
}
.chevron:nth-child(2) {
animation: move 0.2s ease-out 0.2s infinite;
animation-play-state: paused;
animation-delay: calc(var(--scroll) * -1s);
}
/* CHEVRON CHANGED */
.changedchevron {
position: absolute;
width: 38px;
height: 30px;
/* width: 56px;
height: 36px; */
opacity: 0;
transform: scale3d(0.5, 0.5, 0.5);
animation: move 2s ease-out infinite;
/* margin-left: -538px; */
margin-left: -678px;
}
.changedchevronNO {
position: absolute;
width: 38px;
height: 30px;
/* width: 56px;
height: 36px; */
opacity: 0;
transform: scale3d(0.5, 0.5, 0.5);
animation: move 2s ease-out 1;
margin-left: -18px;
}
/* .changedchevron:first-child {
animation: move 2s ease-out 0.2s infinite;
}
.changedchevron:nth-child(2) {
animation: move 2s ease-out 0.2s infinite;
} */
.changedchevron:before,
.changedchevron:after {
content: ' ';
position: absolute;
top: 0;
height: 40%;
height: 40%;
width: 51%;
background: #fff;
}
.changedchevron:before {
left: 0;
transform: skew(0deg, 30deg);
}
.changedchevron:after {
right: 0;
width: 50%;
transform: skew(0deg, -30deg);
}
/* CHEVRON CHANGED END */
.chevron:before,
.chevron:after {
content: ' ';
position: absolute;
top: 0;
height: 100%;
height: 40%;
width: 51%;
background: #fff;
}
.chevron:before {
left: 0;
transform: skew(0deg, 30deg);
}
.chevron:after {
right: 0;
width: 50%;
transform: skew(0deg, -30deg);
}
#keyframes move {
25% {
opacity: 1;
}
33% {
opacity: 1;
transform: translateY(30px);
}
67% {
opacity: 1;
transform: translateY(40px);
}
100% {
opacity: 0;
transform: translateY(55px) scale3d(0.5, 0.5, 0.5);
}
}
.text {
display: block;
margin-top: 75px;
margin-left: -30px;
font-family: "Helvetica Neue", "Helvetica", Arial, sans-serif;
font-size: 17px;
color: #fff !important;
text-transform: uppercase;
white-space: nowrap;
opacity: .25;
animation: pulse 2s linear alternate infinite;
/* margin-left: -60px !important; */
cursor: pointer !important;
/* margin-left: -1058px; */
margin-left: -1338px;
}
#keyframes pulse {
to {
opacity: 1;
}
}
<div style="display: none;" id="header">Header</div>
<div style="width: 100px; height: 500px; overflow: scroll">
test<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>test
</div>

How to make the css animation responsive?

I have the following animation code:
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
#import url('https://fonts.googleapis.com/css2?family=Montserrat+Alternates:wght#500;700&family=Montserrat:wght#400;600&family=Oswald:wght#500&family=Pacifico&family=Roboto:ital,wght#0,400;0,900;1,500&display=swap');
.svg-file path {
fill: transparent;
stroke-width: 3;
stroke: rgb(1, 36, 133);
}
.svg-file.z-logo path {
stroke-dasharray: 550;
stroke-dashoffset: 0;
}
.svg-file.z-logo path {
animation: animate-zlogo 2s linear infinite;
}
.svg-file.z-logo svg {
filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 1));
transform: scale(2);
}
.svg-file h2 {
font-family: "Roboto", cursive;
transform: translate(0, 50px) skewX(-210deg) rotate(-6deg);
font-size: 3em;
color: #044d77;
}
.svg-file span {
animation: dots 2.5s steps(6, end) infinite;
font-size: 5em;
display: block;
transform: translate(0, 65px) skewX(-210deg) rotate(-6deg);
background-color: rgb(5, 46, 80);
width: 8px;
height: 5px;
}
#keyframes fadein-fadeout {
0% {
opacity: 0;
}
50% {
opacity: 1;
}
100% {
opacity: 0;
}
}
#keyframes animate-zlogo {
0% {
stroke-dashoffset: -50;
}
20% {
stroke-dashoffset: 550;
fill: transparent;
}
40% {
fill: transparent;
stroke-dashoffset: 1100;
}
60% {
stroke-dashoffset: 1100;
fill: #05f7f9;
}
80% {
stroke-width: 0;
fill: #05f7f9;
}
100% {
/* stroke-dashoffset: 0; */
stroke-width: 3;
fill: transparent;
}
}
#preloader {
position: fixed;
z-index: 9999;
overflow: hidden;
background: white;
display: flex;
justify-content: center;
align-items: center;
align-content: center;
top: 0px;
left: 0px;
bottom: 0px;
right: 0px;
}
.z-logo svg {
top: 0px;
left: 0px;
bottom: 0px;
right: 0px;
margin: auto;
justify-content: center;
align-items: center;
align-content: center;
position: relative;
display: flex;
width: 50%;
}
.z-logo::before {
content: "";
top: 0px;
left: 0px;
bottom: 0px;
right: 0px;
margin: auto;
background: black;
position: absolute;
display: inline-flex;
border: 1px solid black;
width: 200px;
height: 200px;
}
<div id="preloader">
<div class="svg-file z-logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 133 133" width="133" height="133">
<g id="H">
<path d="M45.33 78.22L87.67 78.22L87.67 133L121.05 133L121.05 0L87.67 0L87.67 49.33L45.33 49.33L45.33 0L11.95 0L11.95 133L45.33 133L45.33 78.22Z"
fill="#47AF9A" />
</g>
</svg>
</div>
</div>
I want to make this animation responsive and work on any device. I tried using #keyframes but I could not get it to work. On my mobile phone, the animation wouldn't even appear. Any suggestions on how I can make this animation responsive? And make it work on any device?
Jsfiddle link: http://jsfiddle.net/JamesD/hr8sL/#&togetherjs=KirD3PPTVk

How to add a small box around a text?

I have the following code:
// Preloader
$(window).on('DOMContentLoaded', function() {
if ($('#preloader').length) {
$('#preloader').delay(1000).fadeOut('slow');
}
});
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
#import url('https://fonts.googleapis.com/css2?family=Montserrat+Alternates:wght#500;700&family=Montserrat:wght#400;600&family=Oswald:wght#500&family=Pacifico&family=Roboto:ital,wght#0,400;0,900;1,500&display=swap');
#preloader {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 9999;
overflow: hidden;
background: white;
display: flex;
justify-content: center;
align-items: center;
}
.svg-file path {
fill: transparent;
stroke-width: 3;
stroke: rgb(1, 36, 133);
}
.svg-file.z-logo path {
stroke-dasharray: 550;
stroke-dashoffset: 0;
}
.svg-file.z-logo path {
animation: animate-zlogo 3s linear infinite;
}
svg {
filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 1));
transform: scale(2);
}
.svg-file h2 {
font-family: "Roboto", cursive;
transform: translate(0, 50px) skewX(-210deg) rotate(-6deg);
font-size: 3em;
color: #044d77;
}
.svg-file span {
animation: dots 2.5s steps(6, end) infinite;
font-size: 5em;
display: block;
transform: translate(0, 65px) skewX(-210deg) rotate(-6deg);
background-color: rgb(5, 46, 80);
width: 8px;
height: 5px;
}
#keyframes fadein-fadeout {
0% {
opacity: 0;
}
50% {
opacity: 1;
}
100% {
opacity: 0;
}
}
#keyframes animate-zlogo {
0% {
stroke-dashoffset: -50;
}
20% {
stroke-dashoffset: 550;
fill: transparent;
}
40% {
fill: transparent;
stroke-dashoffset: 1100;
}
60% {
stroke-dashoffset: 1100;
fill: #05f7f9;
}
80% {
stroke-width: 0;
fill: #05f7f9;
}
100% {
/* stroke-dashoffset: 0; */
stroke-width: 3;
fill: transparent;
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="preloader">
<div class="svg-file z-logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 133 133" width="133" height="133"><g id="H"><path d="M45.33 78.22L87.67 78.22L87.67 133L121.05 133L121.05 0L87.67 0L87.67 49.33L45.33 49.33L45.33 0L11.95 0L11.95 133L45.33 133L45.33 78.22Z" fill="#47AF9A"/></g></svg>
<span></span>
</div>
</div>
I want to add a small box around it, and to better show you what kind of output I am looking for, then I want this in end:
So, all I am missing right now is that background box with the color black, and I do not want the ox to be filled with page cover, it should be approx the same height and width as the picture above. Think of it as being a preloader for a site. In the middle of the page, a small/medium-sized box with h logo displayed inside it like how it is shown above.
Note: The animation should work inside the box, and should not go outside the box, so the animation when you run the above code should take place in the black box. I am just looking for help on how to accurately set u the dimensions of the box like it is shown in the picture. I will adjust the measurements later, but right now I am looking for the output of the box to be displayed.
I tried using the same logic as someone who asked a similar question before, but it did not work and it gave me a black screen which is not what I want. I want the whole screen to be white, but this background box of the image, as shown above, to be black.
Expected Output:
The animation should still perfectly run fine inside the box, and as you can see, the box is in the middle of the screen, and the screen has a whitebackground.
You set a black background on the .svg-file div... and scale the svg to 0.66 (2/3).
// Preloader
$(window).on('DOMContentLoaded', function() {
if ($('#preloader').length) {
$('#preloader').delay(2000).fadeOut('slow');
}
});
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
#import url("https://fonts.googleapis.com/css2?family=Montserrat+Alternates:wght#500;700&family=Montserrat:wght#400;600&family=Oswald:wght#500&family=Pacifico&family=Roboto:ital,wght#0,400;0,900;1,500&display=swap");
#preloader {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 9999;
overflow: hidden;
background: white;
display: flex;
justify-content: center;
align-items: center;
}
#preloader .svg-file {
background-color: black; /* added */
overflow: hidden;
}
#preloader .svg-file path {
fill: transparent;
stroke-width: 3;
stroke: rgb(1, 36, 133);
}
#preloader .svg-file.z-logo path {
stroke-dasharray: 550;
stroke-dashoffset: 0;
}
#preloader .svg-file.z-logo path {
animation: animate-zlogo 3s linear infinite;
}
#preloader svg {
filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 1));
transform: scale(0.66); /* Changed */
}
#preloader .svg-file h2 {
font-family: "Roboto", cursive;
transform: translate(0, 50px) skewX(-210deg) rotate(-6deg);
font-size: 3em;
color: #044d77;
}
#preloader .svg-file span {
animation: dots 2.5s steps(6, end) infinite;
font-size: 5em;
display: block;
transform: translate(0, 65px) skewX(-210deg) rotate(-6deg);
background-color: rgb(5, 46, 80);
width: 8px;
height: 5px;
}
/* Not used
#keyframes fadein-fadeout {
0% {
opacity: 0;
}
50% {
opacity: 1;
}
100% {
opacity: 0;
}
}
*/
#keyframes animate-zlogo {
0% {
stroke-dashoffset: -50;
}
20% {
stroke-dashoffset: 550;
fill: transparent;
}
40% {
fill: transparent;
stroke-dashoffset: 1100;
}
60% {
stroke-dashoffset: 1100;
fill: #05f7f9;
}
80% {
stroke-width: 0;
fill: #05f7f9;
}
100% {
/* stroke-dashoffset: 0; */
stroke-width: 3;
fill: transparent;
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="preloader">
<div class="svg-file z-logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 133 133" width="133" height="133">
<g id="H">
<path d="M45.33 78.22L87.67 78.22L87.67 133L121.05 133L121.05 0L87.67 0L87.67 49.33L45.33 49.33L45.33 0L11.95 0L11.95 133L45.33 133L45.33 78.22Z" fill="#47AF9A" />
</g>
</svg>
<span></span>
</div>
</div>
use ::before pseudo
// Preloader
$(window).on('DOMContentLoaded', function() {
if ($('#preloader').length) {
$('#preloader').delay(1000).fadeOut('slow');
}
});
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
#import url('https://fonts.googleapis.com/css2?family=Montserrat+Alternates:wght#500;700&family=Montserrat:wght#400;600&family=Oswald:wght#500&family=Pacifico&family=Roboto:ital,wght#0,400;0,900;1,500&display=swap');
.svg-file path {
fill: transparent;
stroke-width: 3;
stroke: rgb(1, 36, 133);
}
.svg-file.z-logo path {
stroke-dasharray: 550;
stroke-dashoffset: 0;
}
.svg-file.z-logo path {
animation: animate-zlogo 2s linear infinite;
}
svg {
filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 1));
transform: scale(2);
}
.svg-file h2 {
font-family: "Roboto", cursive;
transform: translate(0, 50px) skewX(-210deg) rotate(-6deg);
font-size: 3em;
color: #044d77;
}
.svg-file span {
animation: dots 2.5s steps(6, end) infinite;
font-size: 5em;
display: block;
transform: translate(0, 65px) skewX(-210deg) rotate(-6deg);
background-color: rgb(5, 46, 80);
width: 8px;
height: 5px;
}
#keyframes fadein-fadeout {
0% {
opacity: 0;
}
50% {
opacity: 1;
}
100% {
opacity: 0;
}
}
#keyframes animate-zlogo {
0% {
stroke-dashoffset: -50;
}
20% {
stroke-dashoffset: 550;
fill: transparent;
}
40% {
fill: transparent;
stroke-dashoffset: 1100;
}
60% {
stroke-dashoffset: 1100;
fill: #05f7f9;
}
80% {
stroke-width: 0;
fill: #05f7f9;
}
100% {
/* stroke-dashoffset: 0; */
stroke-width: 3;
fill: transparent;
}
}
#preloader {
position: absolute;
margin: auto;
z-index: 9999;
overflow: hidden;
background: white;
display: flex;
justify-content: center;
align-items: center;
align-content: center;
top: 0px;
left: 0px;
bottom: 0px;
right: 0px;
}
.z-logo svg {
top: 0px;
left: 0px;
bottom: 0px;
right: 0px;
margin: auto;
justify-content: center;
align-items: center;
align-content: center;
position: relative;
display: flex;
width: 50%;
}
.z-logo::before {
content: "";
top: 0px;
left: 0px;
bottom: 0px;
right: 0px;
margin: auto;
background: black;
position: absolute;
display: inline-flex;
border: 1px solid black;
width: 200px;
height: 200px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="preloader">
<div class="svg-file z-logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 133 133" width="133" height="133"><g id="H"><path d="M45.33 78.22L87.67 78.22L87.67 133L121.05 133L121.05 0L87.67 0L87.67 49.33L45.33 49.33L45.33 0L11.95 0L11.95 133L45.33 133L45.3 78.22Z" fill="#47AF9A"/></g></svg>
<span></span>
</div>
</div>

Align vertical center CSS clock in bootstrap

Facing a problem in this bootstrap code.
section "hero" ( background gradient )
container
CSS & JS clock
text
waves
I want the container to be aligned vertically centered to the xl-lg-md-sm-col screen resolutions with equal padding or margin from top & bottom.
when ever i try adjusting the padding wave at the bottom also moves along.
Need a output like this https://ibb.co/7x3NF2s
here is the code-pen
https://codepen.io/haribabu-manoharan/pen/xxEdWez
// java scrtipt for clock
const deg = 6;
const hr = document.querySelector('#hr');
const mn = document.querySelector('#mn');
const sc = document.querySelector('#sc');
setInterval(() => {
let day = new Date();
let hh = day.getHours() * 30;
let mm = day.getMinutes() * deg;
let ss = day.getSeconds() * deg;
hr.style.transform = `rotateZ(${(hh)+(mm/12)}deg)`;
mn.style.transform = `rotateZ(${mm}deg)`;
sc.style.transform = `rotateZ(${ss}deg)`;
})
// java scrtipt for clock
#hero {
width: 100%;
position: relative;
padding: 260px 0 0 0;
bottom: 0px;
}
/*EDITED NERAM*/
#hero:before {
content: "";
/*background: rgba(2, 5, 161, 0.91);*/
background-image: linear-gradient(111.37738709038058deg, rgba(43, 45, 78, 1) 1.557291666666667%, rgba(225, 20, 139, 1) 101.34895833333333%);
background-repeat: no-repeat;
display: inherit;
align-items: center;
/*added*/
position: absolute;
bottom: 30px;
top: 0;
left: 0;
right: 0;
}
#hero h1 {
margin: 0 0 20px 0;
font-size: 24px;
font-weight: 700;
color: rgba(255, 255, 255, 0.8);
}
#hero h1 span {
color: #fff;
border-bottom: 4px solid #1acc8d;
}
#hero h2 {
color: rgba(255, 255, 255, 0.8);
margin-bottom: 40px;
font-size: 17px;
text-align: justify;
line-height: 27px;
}
#hero .btn-get-started {
font-family: "Montserrat", sans-serif;
font-weight: 500;
font-size: 16px;
letter-spacing: 1px;
display: inline-block;
padding: 10px 30px;
border-radius: 50px;
transition: 0.5s;
color: #fff;
background: #1acc8d;
}
#hero .btn-get-started:hover {
background: #17b57d;
}
#hero .animated {
animation: up-down 2s ease-in-out infinite alternate-reverse both;
}
#media (min-width: 1024px) {
#hero {
background-attachment: fixed;
}
}
#media (max-width: 991px) {
#hero {
padding-top: 260px;
}
#hero .animated {
-webkit-animation: none;
animation: none;
}
#hero .hero-img {
text-align: center;
}
#hero .hero-img img {
max-width: 45%;
}
#hero h1 {
font-size: 22px;
line-height: 30px;
margin-bottom: 10px;
}
#hero h2 {
font-size: 15px;
line-height: 24px;
margin-bottom: 30px;
}
}
#media (max-width: 575px) {
#hero .hero-img img {
width: 80%;
}
}
#-webkit-keyframes up-down {
0% {
transform: translateY(10px);
}
100% {
transform: translateY(-10px);
}
}
#keyframes up-down {
0% {
transform: translateY(10px);
}
100% {
transform: translateY(-10px);
}
}
.hero-waves {
display: block;
margin-top: 70px;
width: 100%;
height: 60px;
z-index: 5;
position: relative;
top: -29px;
}
#media (max-width:767px) {
#hero {
padding-top: 4px;
}
}
.wave1 use {
-webkit-animation: move-forever1 10s linear infinite;
animation: move-forever1 10s linear infinite;
-webkit-animation-delay: -2s;
animation-delay: -2s;
}
.wave2 use {
-webkit-animation: move-forever2 8s linear infinite;
animation: move-forever2 8s linear infinite;
-webkit-animation-delay: -2s;
animation-delay: -2s;
}
.wave3 use {
-webkit-animation: move-forever3 6s linear infinite;
animation: move-forever3 6s linear infinite;
-webkit-animation-delay: -2s;
animation-delay: -2s;
}
#-webkit-keyframes move-forever1 {
0% {
transform: translate(85px, 0%);
}
100% {
transform: translate(-90px, 0%);
}
}
#keyframes move-forever1 {
0% {
transform: translate(85px, 0%);
}
100% {
transform: translate(-90px, 0%);
}
}
#-webkit-keyframes move-forever2 {
0% {
transform: translate(-90px, 0%);
}
100% {
transform: translate(85px, 0%);
}
}
#keyframes move-forever2 {
0% {
transform: translate(-90px, 0%);
}
100% {
transform: translate(85px, 0%);
}
}
#-webkit-keyframes move-forever3 {
0% {
transform: translate(-90px, 0%);
}
100% {
transform: translate(85px, 0%);
}
}
#keyframes move-forever3 {
0% {
transform: translate(-90px, 0%);
}
100% {
transform: translate(85px, 0%);
}
}
/** clock css **/
.clock {
position: relative;
width: 300px;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
background: url(../img/clock.png);
background-size: cover;
border-radius: 50%;
box-shadow: 0 -25px +25px rgba(255, 255, 255, 0.05),
inset 0 -25px +25px rgba(255, 255, 255, 0.05),
0 25px 25px rgba(0, 0, 0, 0.05),
inset 0 25px 25px rgba(0, 0, 0, 0.05);
}
.clock:before {
content: '';
position: absolute;
width: 25px;
height: 25px;
background: #fff;
border-radius: 50%;
z-index: 1000;
}
.clock .hour,
.clock .min,
.clock .sec {
position: absolute;
}
.clock .hour,
.hr {
width: 260px;
height: 150px;
}
.clock .min,
.mn {
width: 250px;
height: 190px;
}
.clock .sec,
.sc {
width: 330px;
height: 205px;
}
.hr,
.mn,
.sc {
display: flex;
justify-content: center;
/*align-items: center;*/
position: absolute;
border-radius: 50%;
}
.hr:before {
content: '';
position: absolute;
width: 12px;
height: 70px;
background: #ff105e;
z-index: 10;
border-radius: 6px 6px 0 0;
}
.mn:before {
content: '';
position: absolute;
width: 4px;
height: 100px;
background: #fff;
z-index: 11;
border-radius: 6px 6px 0 0;
}
.sc:before {
content: '';
position: absolute;
width: 2px;
height: 130px;
background: #fff;
z-index: 12;
border-radius: 6px 6px 0 0;
}
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<title>Hello, world!</title>
</head>
<body>
<section id="hero">
<div class="container d-flex align-items-center">
<div class="row pt-lg-n5 mt-col-5 pt-col-5 mt-sm-5 pt-sm-5 mt-md-0 pt-md-0 d-flex align-self-center">
<div class="justify-content-sm-center col-12 col-md-6 col-lg-5 offset-xl-1 col-xl-4 order-1 d-flex align-items-center hero-img" data-aos="zoom-out" data-aos-delay="300">
<!-- HTML for clock -->
<div class="clock">
<div class="hour">
<div class="hr" id="hr"></div>
</div>
<div class="min">
<div class="mn" id="mn"></div>
</div>
<div class="sec">
<div class="sc" id="sc"></div>
</div>
</div>
<!-- End HTML for clock -->
</div>
<div class="col-12 col-md-6 offset-lg-0 col-lg-7 col-xl-6 order-2 d-flex align-items-center">
<div data-aos="zoom-out">
<h1>Why neram Classes for <span>NATA Coaching ?</span></h1><br>
<h2>We are team of talanted practising architects from IITs & NITs started this for betterment of this Architecture profession </h2>
<div class="text-center text-lg-left">
Get Started
</div>
</div>
</div>
</div>
</div>
<svg class="hero-waves" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 24 150 28 " preserveAspectRatio="none">
<defs>
<path id="wave-path" d="M-160 44c30 0 58-18 88-18s 58 18 88 18 58-18 88-18 58 18 88 18 v44h-352z">
</defs>
<g class="wave1">
<use xlink:href="#wave-path" x="50" y="1" fill="rgba(255,255,255, .1)">
</g>
<g class="wave2">
<use xlink:href="#wave-path" x="50" y="-2" fill="rgba(255,255,255, .2)">
</g>
<g class="wave3">
<use xlink:href="#wave-path" x="50" y="7" fill="#fff">
</g>
</svg>
</section>
<!-- Optional JavaScript; choose one of the two! -->
<!-- Option 1: Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW" crossorigin="anonymous"></script>
</body>
</html>

creating scroll animation with css

I am trying to create a header menu when I scroll down it to get involved with animation into a circle and when it scrolled up it will be come back again . I checked the window is top if not then animate with javascript . But my code is not working .
$header = $('.header__fake');
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll > 20) {
$header.addClass('animated').removeClass('fix');
} else {
$header.removeClass('animated').addClass('fix');
}
});
body {
background: #02021a url("http://i.imgur.com/705GHlC.jpg") no-repeat 0 0;
-webkit-background-size: 100% auto;
background-size: 100% auto;
color: #fff;
font-family: Helvetica Neue, Helvetica, Open sans, Arial, sans-serif;
font-weight:lighter;
letter-spacing:1px;
}
.content {
width: 320px;
position: relative;
margin: 0 auto;
}
.content h2 {
margin: 35px 0 0;
}
.content h1 {
text-align: center;
margin: 1000px 0 200px;
}
.content h1 span {
display: block;
width: 100%;
margin: 5px 0 0;
opacity: .5;
}
.content .header__fake {
position: fixed;
top: 15px;
left: 50%;
margin-left: -160px;
width: 320px;
}
.content .header__fake i {
display: block;
}
.content .header__fake .btm__border {
height: 1px;
background: #fff;
position: absolute;
bottom: 6px;
left: 0;
right: 0;
-webkit-transition: left 0.5s;
transition: left 0.5s;
}
.content .header__fake .icn__wrap {
cursor: pointer;
float: right;
width: 58px;
position: relative;
height: 58px;
margin-right: -20px;
}
.content .header__fake .icn__wrap .icn__hamburger {
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translateX(-50%) translateY(-6px);
-ms-transform: translateX(-50%) translateY(-6px);
transform: translateX(-50%) translateY(-6px);
display: block;
width: 18px;
height: 1px;
z-index: 999;
background: #fff;
}
.content .header__fake .icn__wrap .icn__hamburger:after,
.content .header__fake .icn__wrap .icn__hamburger:before {
content: "";
float: left;
display: block;
width: 100%;
height: 1px;
background: #fff;
margin: 5px 0 0;
}
.content .header__fake .icn__wrap .icn__hamburger:before {
margin: 6px 0 0;
}
.content .header__fake .icn__wrap svg {
z-index: 10;
}
.content .header__fake .icn__wrap svg circle {
fill: none;
stroke: #fff;
stroke-width: .5;
stroke-linecap: round;
stroke-linejoin: round;
stroke-dasharray: 39 39;
stroke-dashoffset: -39;
-webkit-transition: stroke-dashoffset 0.5s;
transition: stroke-dashoffset 0.5s;
}
.content .header__fake.animated .btm__border {
left: 100%;
right: 4px;
}
.content .header__fake.animated svg circle {
stroke-dashoffset: 0;
-webkit-transition: stroke-dashoffset 0.5s;
transition: stroke-dashoffset 0.5s;
}
.content .header__fake.fix .btm__border {
-webkit-animation: fix 0.2s linear;
animation: fix 0.2s linear;
-webkit-animation-delay: 0.2s;
animation-delay: 0.2s;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
right: 5px;
}
#-webkit-keyframes fix {
from {
right: 5px;
}
to {
right: 0px;
}
}
#keyframes fix {
from {
right: 5px;
}
to {
right: 0px;
}
}
<div class="content">
<h2>Scroll to see the magic.</h2>
<div class="header__fake">
<div class="icn__wrap">
<i class="icn__hamburger"></i>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="58px" height="58px" viewBox="0 0 16 16" preserveAspectRatio="none">
<circle cx="8" cy="8" r="6.215" transform="rotate(90 8 8)"></circle>
</svg>
</div>
<i class="btm__border"></i>
</div>
<h1>Hmm<span>Now scroll back up.</span></h1>
</div>
I pasted above code in JSfiddle. It works perfectly. See it here
The problem could be with your jQuery lib initialization.

Categories

Resources