SourceCode Company Button dan POP UP

Bagikan

HTML

 

<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<link rel=”stylesheet” href=”styles.css”>
<title>Gradient Button with Pop Up</title>
</head>
<body>

<button class=”gradient-button” id=”popupButton”>Click me</button>

<div class=”popup” id=”myPopup”>
<span class=”close” onclick=”closePopup()”>&times;</span>
<p>This is a Pop Up!</p>
</div>

<script src=”app.js”></script>

</body>
</html>

 

Baca juga tentang sourcecode Web Banner

 

CSS

 

body {
font-family: ‘Arial’, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}

.gradient-button {
background: linear-gradient(to right, #fd746c, #ff9068);
color: #fff;
border: none;
padding: 15px 30px;
font-size: 16px;
cursor: pointer;
border-radius: 5px;
transition: background 0.3s ease-in-out;
}

.gradient-button:hover {
background: linear-gradient(to left, #fd746c, #ff9068);
}

.popup {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: #fff;
padding: 20px;
border-radius: 5px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.popup p {
margin: 0;
}

.close {
position: absolute;
top: 10px;
right: 10px;
font-size: 20px;
color: #333;
cursor: pointer;
}

 

Baca juga tentang landing page sourcecode

 

Javascript (App.js)

function openPopup() {
document.getElementById(‘myPopup’).style.display = ‘block’;
}

function closePopup() {
document.getElementById(‘myPopup’).style.display = ‘none’;
}

document.getElementById(‘popupButton’).addEventListener(‘click’, openPopup);

 

Dalam contoh ini, tombol memiliki efek warna gradient, dan ketika tombol tersebut diklik, sebuah Pop Up muncul dengan pesan sederhana.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top