Ben Gadgets PH
html, body {
margin: 0;
padding: 0;
background-color: #FFDF80;
font-family: Arial, sans-serif;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
background-color: #FFDF80;
}
.container img {
display: block;
width: 90%;
max-width: 1000px;
height: auto;
margin: 15px auto;
border: none;
}
.container a {
position: relative;
display: block;
text-decoration: none;
width: 90%;
max-width: 1000px;
margin: 15px auto;
}
.container a img {
transition: transform 0.3s ease, box-shadow 0.3s ease;
width: 100%;
height: auto;
}
.container a:hover img {
transform: scale(1.02);
box-shadow: 0 0 15px rgba(0,0,0,0.3);
cursor: pointer;
}
.container a::after {
content: “Tap to View”;
position: absolute;
bottom: 10px;
right: 10px;
background: rgba(0,0,0,0.6);
color: #fff;
padding: 6px 12px;
font-size: 14px;
border-radius: 4px;
opacity: 0;
transition: opacity 0.3s ease;
}
.container a:hover::after { opacity: 1; }
@media (hover: none) {
.container a img:active {
transform: scale(0.98);
box-shadow: 0 0 10px rgba(0,0,0,0.2);
}
.container a::after { opacity: 1; }
}
/* Slider styling */
.slider {
position: relative;
width: 90%;
max-width: 1000px;
margin: 20px auto;
overflow: hidden;
border-radius: 8px;
background: #fff;
}
.slides {
display: flex;
transition: transform 0.5s ease-in-out;
}
.slides img {
flex: 0 0 100%;
width: 100%;
height: auto;
}
.prev, .next {
position: absolute;
top: 50%;
transform: translateY(-50%);
background: rgba(0,0,0,0.5);
color: #fff;
border: none;
padding: 10px;
cursor: pointer;
border-radius: 50%;
z-index: 1;
}
.prev { left: 10px; }
.next { right: 10px; }
@media (max-width: 768px) {
.container img, .container a, .slider {
width: 100%;
max-width: 100%;
}
}
function initSlider(sliderId, interval=3000) {
const slider = document.getElementById(sliderId);
const slides = slider.querySelector(‘.slides’);
const totalSlides = slides.children.length;
let currentIndex = 0;
function showSlide(index) {
const width = slider.clientWidth;
slides.style.transform = `translateX(${-index * width}px)`;
}
function move(direction) {
currentIndex += direction;
if (currentIndex = totalSlides) currentIndex = 0;
showSlide(currentIndex);
}
slider.querySelector(‘.prev’).onclick = () => move(-1);
slider.querySelector(‘.next’).onclick = () => move(1);
setInterval(() => move(1), interval);
window.addEventListener(‘resize’, () => showSlide(currentIndex));
}
initSlider(‘slider1’, 3000);
initSlider(‘slider2’, 3000);