var bannerWrappers = document.querySelectorAll('.banner_wrapper'); bannerWrappers.forEach(function(bannerWrapper) { var xButton = document.createElement('button'); xButton.innerHTML = '×'; xButton.style.position = 'absolute'; xButton.style.top = '0'; xButton.style.right = '0'; xButton.style.padding = '0 5px'; xButton.style.border = 'none'; xButton.style.backgroundColor = '#ffffff'; xButton.style.color = '#000'; xButton.style.fontWeight = 'bold'; xButton.style.fontSize = '25px'; xButton.style.lineHeight = '24px'; xButton.style.cursor = 'pointer'; xButton.style.boxShadow = 'rgb(0, 0, 0) 0px 2px 4px'; xButton.style.borderRadius = '2px'; xButton.style.transition = 'background-color 0.3s'; // Tạm ẩn nút X và xuất hiện sau 3s xButton.style.display = 'none'; setTimeout(function() { xButton.style.display = 'block'; }, 3000); // Hiệu ứng hoạt hình khi hover xButton.addEventListener('mouseover', function() { xButton.style.backgroundColor = '#e0e0e0'; }); xButton.addEventListener('mouseout', function() { xButton.style.backgroundColor = '#ffffff'; }); xButton.addEventListener('click', function() { bannerWrappers.forEach(function(banner) { banner.style.display = 'none'; }); }); bannerWrapper.appendChild(xButton); });