<!-- https://t.me/Web_Designer98 -->
<!DOCTYPE html>
<html lang="fa">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title> @Web_Designer98</title>
<style type="text/css">
body {
font-family: Arial, sans-serif;
}
.toast {
visibility: hidden;
min-width: 250px;
margin-left: -125px;
background-color: #333;
color: #fff;
text-align: center;
border-radius: 5px;
padding: 16px;
position: fixed;
z-index: 1;
left: 50%;
bottom: 30px;
font-size: 17px;
}
.toast.show {
visibility: visible;
animation: fadein 0.5s, fadeout 0.5s 2.5s;
}
@keyframes fadein {
from { bottom: 0; opacity: 0; }
to { bottom: 30px; opacity: 1; }
}
@keyframes fadeout {
from { bottom: 30px; opacity: 1; }
to { bottom: 0; opacity: 0; }
}
</style>
<!-- https://t.me/Web_Designer98 -->
</head>
<body>
<!-- https://t.me/Web_Designer98 -->
<button onclick="showToast()">نمایش پیام</button>
<div id="toast" class="toast">پیام شما با موفقیت ارسال شد!</div>
<!-- https://t.me/Web_Designer98 -->
<!-- https://t.me/Web_Designer98 -->
<script type="text/Javascript">
function showToast() {
const toast = document.getElementById("toast");
toast.classList.add("show");
setTimeout(() => {
toast.classList.remove("show");
}, 3000);
}
</script>
<!-- https://t.me/Web_Designer98 -->
</body>
</html>
🌀 توضیحات:
➕ با کلیک بر روی دکمه "نمایش پیام"، تابع showToast فراخوانی میشود که پیام توست را نمایش میدهد، پیام به مدت 3 ثانیه در صفحه باقی میماند و سپس محو میشود.
#css #html #js
🌈 Web_Designer98.t.me