Merhaba Dostlar;
Bugün sizlere Html, Css ve Javascript ile Animasyonlu Button yapmayı göstereceğim bu butonu kendinize göre istediğiniz şekilde düzenleyebilirsiniz.
İlk olarak bir Html dosyası oluşturun ve <body> </body> arasına şu kodları yazın,
<div class="submit">Button</div>
<div class="container">
<div class="message">
<div id='svg-animation'></div>
<div class="success">Butona Tıklandı</div>
<span class="close"></span>
</div>
<div class="layout-in"></div>
</div>
<div class="final">Bizi Tercih Ettiğiniz için Teşekkürler</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bodymovin/5.9.3/lottie.min.
js"
integrity="sha512-e0f5QhAghpnR7F96ocZHSXHNrM1ugw32mmQJsKg02ADeVj7uxFkG5UA+Hgr
cTTxcPWp415lH+1l1b4nZtyqnsg=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
Burada Html kodlarını yazdık ve html kodu bitti şimdi Css koduna geçebiliriz,
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: "Open Sans", sans-serif;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.submit {
font-size: 20px;
font-weight: bold;
text-transform: uppercase;
background-color: #0250cc;
color: white;
padding: 10px 20px;
border-radius: 6px;
user-select: none;
cursor: pointer;
transition: 0.3s;
}
.submit.clicked {
opacity: 0;
transform: scale(0);
}
.container {
opacity: 1;
transition: 0.3s;
width: 100%;
height: 100vh;
left: 0;
top: 0;
position: fixed;
z-index: -1;
}
.container.showen {
z-index: 0;
}
.message {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%) scale(0);
width: 400px;
height: 200px;
background-color: white;
border-radius: 6px;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
padding: 20px;
z-index: 1;
transition: 0.3s;
}
.container.showen .message {
transform: translate(-50%, -50%) scale(1);
}
@media (max-width: 768px) {
.message {
width: 350px;
}
}
#svg-animation {
width: 150px;
overflow: hidden;
}
.success {
font-size: 18px;
font-weight: bolder;
text-transform: uppercase;
}
.close {
position: absolute;
width: 20px;
height: 20px;
border-radius: 50%;
background-color: #0250cc;
left: calc(100% - 10px);
top: -10px;
cursor: pointer;
transition: 0.3s;
display: flex;
justify-content: center;
align-items: center;
}
.close:hover,
.submit:hover {
background-color: #0206cc;
}
.close::before,
.close::after {
content: '';
width: 5px;
height: 5px;
transform: rotate(-45deg);
}
.close::before {
border-bottom: 2px solid white;
border-right: 2px solid white;
}
.close::after {
border-top: 2px solid white;
border-left: 2px solid white;
}
@media (max-width: 768px) {
.close {
width: 30px;
height: 30px;
left: calc(100% - 15px);
top: -15px;
}
.close::before,
.close::after {
width: 6px;
height: 6px;
}
}
.layout-in {
width: 100vw;
height: 100vh;
background-color: #00000059;
position: absolute;
left: -100%;
top: 0;
opacity: 0;
transition: 0.3s;
}
.container.showen .layout-in {
opacity: 1;
left: 0;
}
.final {
opacity: 0;
transition: 0.3s;
transform: scale(0);
top: 0;
font-size: 18px;
position: absolute;
margin-top: 20px;
background-color: #0250cc;
color: white;
padding: 10px 20px;
border-radius: 6px;
}
.final.showen {
transform: scale(1);
opacity: 1;
}
Css kodumuz da bittiğine göre artık Javascript kodumuza geçebiliriz,
let SubmitBtn = document.querySelector(".submit");
let layout = document.querySelector(".container");
let layoutIn = document.querySelector(".layout-in");
let closeBtn = document.querySelector(".close");
let finalmess = document.querySelector(".final");
SubmitBtn.onclick = function () {
this.classList.add("clicked");
layout.classList.add("showen");
bodymovin.loadAnimation({
wrapper: document.getElementById("svg-animation"),
animType: "svg",
loop: false,
path: "https://raw.githubusercontent.com/Abdallah-Mohamed-Sayed/some-files/ma
in/True-sign.json",
});
};
closeBtn.onclick = function () {
layout.classList.remove("showen");
finalShowen();
};
layoutIn.onclick = function () {
layout.classList.remove("showen");
finalShowen();
};
function finalShowen() {
finalmess.classList.add("showen");
setTimeout(() => {
finalmess.classList.remove("showen");
}, 3000);
}
Ve Javascript Kodumuz da bitti Artık Projemiz Hazır Tüm Yazıları Kendinize göre düzenleyebilirsiniz ve Koda Ulaşmak için Buraya Tıklayın.
Tüm Kod:
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Animasyonlu Button - Mossarb</title>
</head>
<body>
<div class="submit">Button</div>
<div class="container">
<div class="message">
<div id='svg-animation'></div>
<div class="success">Butona Tıklandı</div>
<span class="close"></span>
</div>
<div class="layout-in"></div>
</div>
<div class="final">Bizi Tercih Ettiğiniz için Teşekkürler</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bodymovin/5.9.3/lottie.min.
js"
integrity="sha512-e0f5QhAghpnR7F96ocZHSXHNrM1ugw32mmQJsKg02ADeVj7uxFkG5UA+Hgr
cTTxcPWp415lH+1l1b4nZtyqnsg=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: "Open Sans", sans-serif;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.submit {
font-size: 20px;
font-weight: bold;
text-transform: uppercase;
background-color: #0250cc;
color: white;
padding: 10px 20px;
border-radius: 6px;
user-select: none;
cursor: pointer;
transition: 0.3s;
}
.submit.clicked {
opacity: 0;
transform: scale(0);
}
.container {
opacity: 1;
transition: 0.3s;
width: 100%;
height: 100vh;
left: 0;
top: 0;
position: fixed;
z-index: -1;
}
.container.showen {
z-index: 0;
}
.message {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%) scale(0);
width: 400px;
height: 200px;
background-color: white;
border-radius: 6px;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
padding: 20px;
z-index: 1;
transition: 0.3s;
}
.container.showen .message {
transform: translate(-50%, -50%) scale(1);
}
@media (max-width: 768px) {
.message {
width: 350px;
}
}
#svg-animation {
width: 150px;
overflow: hidden;
}
.success {
font-size: 18px;
font-weight: bolder;
text-transform: uppercase;
}
.close {
position: absolute;
width: 20px;
height: 20px;
border-radius: 50%;
background-color: #0250cc;
left: calc(100% - 10px);
top: -10px;
cursor: pointer;
transition: 0.3s;
display: flex;
justify-content: center;
align-items: center;
}
.close:hover,
.submit:hover {
background-color: #0206cc;
}
.close::before,
.close::after {
content: '';
width: 5px;
height: 5px;
transform: rotate(-45deg);
}
.close::before {
border-bottom: 2px solid white;
border-right: 2px solid white;
}
.close::after {
border-top: 2px solid white;
border-left: 2px solid white;
}
@media (max-width: 768px) {
.close {
width: 30px;
height: 30px;
left: calc(100% - 15px);
top: -15px;
}
.close::before,
.close::after {
width: 6px;
height: 6px;
}
}
.layout-in {
width: 100vw;
height: 100vh;
background-color: #00000059;
position: absolute;
left: -100%;
top: 0;
opacity: 0;
transition: 0.3s;
}
.container.showen .layout-in {
opacity: 1;
left: 0;
}
.final {
opacity: 0;
transition: 0.3s;
transform: scale(0);
top: 0;
font-size: 18px;
position: absolute;
margin-top: 20px;
background-color: #0250cc;
color: white;
padding: 10px 20px;
border-radius: 6px;
}
.final.showen {
transform: scale(1);
opacity: 1;
}
</style>
<script>
let SubmitBtn = document.querySelector(".submit");
let layout = document.querySelector(".container");
let layoutIn = document.querySelector(".layout-in");
let closeBtn = document.querySelector(".close");
let finalmess = document.querySelector(".final");
SubmitBtn.onclick = function () {
this.classList.add("clicked");
layout.classList.add("showen");
bodymovin.loadAnimation({
wrapper: document.getElementById("svg-animation"),
animType: "svg",
loop: false,
path: "https://raw.githubusercontent.com/Abdallah-Mohamed-Sayed/some-files/ma
in/True-sign.json",
});
};
closeBtn.onclick = function () {
layout.classList.remove("showen");
finalShowen();
};
layoutIn.onclick = function () {
layout.classList.remove("showen");
finalShowen();
};
function finalShowen() {
finalmess.classList.add("showen");
setTimeout(() => {
finalmess.classList.remove("showen");
}, 3000);
}
</script>
</body>
</html>
Animasyonlu Button Yapımı Dersi Bitti. Takipte Kalın.
![]() |
https://www.datahit.com.tr/hizmetlerimiz/kurumsal-yazilim/ |
Python ile Kişisel Sesli Asistanını Yap
0 Yorumlar