selam arkadaşlar popup kodu olan elinde paylaşabilir mi?
günde 2 kez sitede bir yere tıkladıgında a sitemi açtırmak istiyorum popup ile teşekkür ederim.
popup kodu lazım
3
●108
- 14-12-2024, 18:42:36Üyeliği durduruldu
<!DOCTYPE html> <html lang="tr"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Popup Örneği</title> <script> // Günlük tıklama sınırını ve açılacak URL'yi tanımla const MAX_CLICKS = 2; // Günde maksimum izin verilen popup sayısı const SITE_URL = "https://www.example.com"; // Popup ile açılacak sitenin adresi const STORAGE_KEY = "popupClicks"; // LocalStorage anahtarı function checkAndOpenPopup() { // Bugünün tarihini al const today = new Date().toDateString(); // LocalStorage'daki tıklama bilgilerini oku const storedData = JSON.parse(localStorage.getItem(STORAGE_KEY)) || { date: null, clicks: 0 }; // Eğer tarih değişmişse tıklama sayısını sıfırla if (storedData.date !== today) { storedData.date = today; storedData.clicks = 0; } // Günlük tıklama sınırını kontrol et if (storedData.clicks < MAX_CLICKS) { window.open(SITE_URL, "_blank"); // Popup'u aç storedData.clicks += 1; // Tıklama sayısını artır localStorage.setItem(STORAGE_KEY, JSON.stringify(storedData)); // Güncellenen veriyi kaydet } else { console.log("Bugünlük popup sınırına ulaşıldı."); } } // Sayfanın herhangi bir yerine tıklama olayını dinle document.addEventListener("click", () => { checkAndOpenPopup(); }); </script> </head> <body> <h1>Herhangi bir yere tıkla, popup açılsın!</h1> <p>Bugün için en fazla 2 kez popup açılmasına izin verilir.</p> </body> </html> - 14-12-2024, 18:45:01işe yaramadı hocam bu kod teşekkürlerAreonYazilim adlı üyeden alıntı: mesajı görüntüle
- 14-12-2024, 18:47:31umarım işinize yararmoosy adlı üyeden alıntı: mesajı görüntüle
<!DOCTYPE html> <html lang="tr"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Özelleştirilmiş Popup</title> <style> /* Genel sayfa stili */ body { font-family: Arial, sans-serif; margin: 0; padding: 0; } /* Popup stili */ .popup { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.7); justify-content: center; align-items: center; z-index: 9999; animation: fadeIn 0.5s ease; } /* Popup içerik stili */ .popup-content { background-color: #fff; padding: 20px; border-radius: 10px; width: 80%; max-width: 500px; text-align: center; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); } /* Başlık ve mesaj */ .popup-content h2 { color: #333; } .popup-content p { font-size: 16px; color: #555; } /* Kapatma butonu */ .close-btn { background-color: #f44336; color: #fff; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; font-size: 16px; margin-top: 20px; } .close-btn:hover { background-color: #d32f2f; } /* Fade-in animasyonu */ @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } </style> </head> <body> <!-- Buton: Tıklama yapılacak yer --> <button id="click-button" style="margin: 50px; padding: 15px; font-size: 18px; cursor: pointer;">Buraya Tıklayın</button> <!-- Popup yapısı --> <div id="popup" class="popup"> <div class="popup-content"> <h2>Teşekkürler!</h2> <p>Bu tıklamanız için teşekkür ederiz! <br> Hemen <a href="http://a.sitemi.com" target="_blank">sitemizi ziyaret edin</a>.</p> <button class="close-btn">Kapat</button> </div> </div> <script> let clickCount = parseInt(localStorage.getItem('clickCount')) || 0; // Popup'ı gösterme fonksiyonu function showPopup() { document.getElementById('popup').style.display = 'flex'; } // Popup'ı kapatma fonksiyonu function closePopup() { document.getElementById('popup').style.display = 'none'; } // Kullanıcı butona tıkladığında document.getElementById('click-button').addEventListener('click', function() { if (clickCount < 2) { clickCount++; localStorage.setItem('clickCount', clickCount); // Tıklama sayısını kaydet setTimeout(function() { showPopup(); // Popup'ı göster }, 500); // 500ms sonra popup'ı göster } else { alert('Bugün maksimum tıklama sayısına ulaştınız!'); } }); // Kapatma butonuna tıklama document.querySelector('.close-btn').addEventListener('click', function() { closePopup(); }); // Popup dışına tıklama ile kapanma window.addEventListener('click', function(event) { if (event.target === document.getElementById('popup')) { closePopup(); } }); </script> </body> </html>