window.onbeforeunload = function() {
window.scrollTo(0, 0);
};var isSectionLocked = true; // Menyimpan status kunci tampilan section// Mengunci tampilan section pertama saat halaman dimuat
window.addEventListener('DOMContentLoaded', function() {
lockSection();
});// Fungsi untuk mengunci tampilan section
function lockSection() {
if (isSectionLocked) {
disableScrolling();
document.body.style.position = "fixed";
document.body.style.overflowY = "scroll";
document.body.style.height = "100vh";
document.getElementById("section-cover").style.width = "100vw"; // Menambahkan gaya untuk membuat cover full width
}
}// Fungsi untuk membuka tampilan section
function unlockSection() {
enableScrolling();
document.body.style.position = "";
document.body.style.overflowY = "";
document.getElementById("section-cover").style.width = ""; // Menghapus gaya untuk mengembalikan lebar cover ke nilai aslinya
document.getElementById("tombol-buka").style.display = "none"; // Menyembunyikan tombol "tombol-buka"
}document.getElementById("tombol-buka").onclick = function() {
unlockSection();
playAudio();
};function disableScrolling() {
var x = window.scrollX;
var y = window.scrollY;
window.onscroll = function() {
window.scrollTo(x, y);
};
}function enableScrolling() {
window.onscroll = null;
}function playAudio(){
var isYT = false;
if(document.body.contains(document.getElementById("song"))) {
document.getElementById("song").play();
isYT = false;
} else {
isYT = true;
player.playVideo();
}
}
//Script Custom Nama Tamu by Andy dari WeddingPress
var urlParams = new URLSearchParams(window.location.search);
if (urlParams) {
var textElement = document.getElementById('namatamu');
var defaultText = textElement.innerHTML;
var newText = defaultText;if (urlParams.has('to')) {
var toValue = urlParams.get('to');
newText = newText.replace(/Tamu Undangan/g, toValue);
}if (urlParams.has('dear')) {
var dearValue = urlParams.get('dear');
newText = newText.replace(/Tamu Undangan/g, dearValue);
}if (urlParams.has('kepada')) {
var kepadaValue = urlParams.get('kepada');
newText = newText.replace(/Tamu Undangan/g, kepadaValue);
}textElement.innerHTML = newText;
}
function revealElements(selector) {
var elements = document.querySelectorAll(selector);
var windowHeight = window.innerHeight;
var elementVisible = 150;elements.forEach(function(element) {
var elementTop = element.getBoundingClientRect().top;
if (elementTop < windowHeight - elementVisible) {
element.classList.add("active");
} else {
element.classList.remove("active");
}
});
}window.addEventListener("scroll", function() {
revealElements(".muncul, .muncul-kiri, .muncul-kanan, .zoom");
});.goyang-1 {
animation-name: goyang1;
animation-duration: 3.5s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}@keyframes goyang1{
0%{ transform: rotate(0deg) scale(1); }
50%{ transform: rotate(10deg) scale(1.1); }
75%{ transform: rotate(-5deg) scale(1.1); }
100%{ transform: rotate(0deg) scale(1); }}.naik-turun {
animation-name: naikturun;
animation-duration: 2s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}@keyframes naikturun {
0% { transform: translate(0px,0px); }
50% { transform: translate(0px,-10px); }
100% { transform: translate(0px,0px); }
}.muncul {
position: relative;
transform: translateY(6rem) scale(0.93);
opacity: 0;
transition: opacity 0.5s ease, transform 1s ease; /* Durasi muncul tanpa delay */
}.muncul.active {
transform: translateY(0);
opacity: 1;
}.muncul-kiri {
position: relative;
transform: translateX(-100%) scale(0.93);
opacity: 0;
transition: opacity 0.5s ease, transform 1s ease; /* Durasi muncul tanpa delay */
}.muncul-kiri.active {
transform: translateX(0);
opacity: 1;
}.muncul-kanan {
position: relative;
transform: translateX(100%) scale(0.93);
opacity: 0;
transition: opacity 0.5s ease, transform 1s ease; /* Durasi muncul tanpa delay */
}.muncul-kanan.active {
transform: translateX(0);
opacity: 1;
}.zoom {
position: relative;
transform: scale(0.5);
opacity: 0;
transition: opacity 0.5s ease, transform 1.5s ease; /* Durasi muncul tanpa delay */
}.zoom.active {
transform: scale(1);
opacity: 1;
}
//* script show-hide by andy dari weddingpress *//document.addEventListener("DOMContentLoaded", function () {
var btnAmplop = document.getElementById("btnAmplop");
var btnHide = document.getElementById("btn-hide");
var amplop = document.getElementById("amplop");// Sembunyikan btn-hide dan amplop saat halaman dimuat
btnHide.style.display = "none";
amplop.style.display = "none";// Fungsi untuk menampilkan btn-hide dan amplop saat btnAmplop diklik
btnAmplop.onclick = function () {
// Menampilkan btn-hide
btnHide.style.display = "block";
// Menyembunyikan btnAmplop
btnAmplop.style.display = "none";
// Menampilkan section amplop
amplop.style.display = "block";
};// Fungsi untuk menampilkan btnAmplop kembali dan menyembunyikan btn-hide saat btn-hide diklik
btnHide.onclick = function () {
// Menyembunyikan btn-hide
btnHide.style.display = "none";
// Menampilkan btnAmplop kembali
btnAmplop.style.display = "block";
// Menyembunyikan section amplop
amplop.style.display = "none";
};
});