Skip to content

Commit

Permalink
add a button to add widget to your website
Browse files Browse the repository at this point in the history
  • Loading branch information
iammunendrasingh committed Sep 12, 2024
1 parent 54fb9fc commit 0b921c0
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
3 changes: 3 additions & 0 deletions visualize/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ <h3 style="text-align: center;">Visualize WhatsApp Widget on your Website</h3>
</div>
<div class="bottom" id="bottom">
<div class="fullscreen-btn-container"><button id="fullscreen-btn" class="fullscreen-btn">↕️ Full Screen ↕️</button></div>
<button id="promo-btn" class="promo-btn">
💬 Like this? Add to your website!
</button>
<iframe id="website-frame" src="https://iammunendrasingh.github.io/free-whatsapp-chat-widget/" frameborder="0"></iframe>
</div>
</div>
Expand Down
12 changes: 12 additions & 0 deletions visualize/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,15 @@ document.addEventListener('DOMContentLoaded', function () {
document.getElementById('bottom').style.height = isFullScreen ? 'calc(100vh - 10px)' : 'calc(100vh - 200px - 10px)'; // 40px for button
});
});

window.addEventListener('DOMContentLoaded', () => {
const promoBtn = document.getElementById('promo-btn');
setTimeout(() => {
promoBtn.style.transform = 'translateX(0)';
promoBtn.style.opacity = '1';
}, 3000);

promoBtn.addEventListener('click', () => {
window.open('https://iframeweb.com/tools/free-whatsapp-chat-widget-for-website/', '_blank');
});
});
25 changes: 25 additions & 0 deletions visualize/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,31 @@ button#fullscreen-btn:hover {
height: 100vh !important;
}

.promo-btn {
position: absolute;
top: 5em;
right: 2em;
padding: 12px 20px;
font-size: 1em;
background-color: #28a745;
color: white;
border: none;
border-radius: 8px;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 8px;
opacity: 0;
transform: translateX(100%);
transition: transform 0.6s ease, opacity 0.6s ease;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.promo-btn:hover {
background-color: #218838;
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

@media only screen and (max-width: 600px) {
.form-section {
padding: 10px;
Expand Down

0 comments on commit 0b921c0

Please sign in to comment.