How can I increase image size and add a zoom effect?

learningdesign
Shopify Partner
126 1 15

Capture.PNG

https://www.affiliateofficial.co.uk/?_ab=0&_fd=0&_sc=1

above is the link how to make image size bigger and how to add a zoom effect like where i point the mouse that area zooms can some one please send me code 
below is the code which i am using

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image Change on Button Click</title>
<style>
body {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
margin: 10px;
}
.box-container {
display: flex;
justify-content: center;
}
.box {
width: 90%; /* Adjust width to be responsive */
max-width: 500px; /* Maximum width */
height: auto; /* Height auto for aspect ratio maintenance */
margin: 10px;
position: relative; /* Add position relative for button positioning */
}
.image {
width: 120%; /* Increase width */
height: auto;
object-fit: cover;
display: none; /* Hide all images by default */
transition: transform 0.3s; /* Add transition for smooth zoom effect */
}
.image.active {
display: block; /* Show the active image */
}
.btn-container {
text-align: center;
margin-bottom: 20px;
display: flex; /* Use flexbox */
justify-content: space-between; /* Space between the buttons */
width: 90%; /* Adjust width */
}
/* Style for individual box buttons */
.box-btn {
margin: 5px;
background-color: black;
color: white;
border: none;
padding: 10px 20px;
cursor: pointer;
border-radius: 5px;
}

/* Media query for desktop responsiveness */
@media only screen and (min-width: 601px) {
.btn-container {
justify-content: center; /* Center the buttons on desktop */
}
.box-btn:nth-child(1) {
margin-right: 140px; /* Add right margin to the first button on desktop */
}
.box-btn:nth-child(2) {
margin-left: 190px; /* Add left margin to the second button on desktop */
}
}

/* Media query for mobile responsiveness */
@media only screen and (max-width: 600px) {
.btn-container {
flex-direction: column; /* Change to column layout */
align-items: center; /* Center the buttons */
}
.box-btn {
margin: 5px 0; /* Adjust vertical margin */
}
}
</style>
</head>
<body>
<div class="container">
<div class="btn-container">
<!-- Button to toggle between image sets -->
<button class="box-btn" onclick="toggleImageSet('box1')">Reverse Image</button>
<button class="box-btn" onclick="toggleImageSet('box2')">Reverse Image</button>
</div>
<div class="box-container">
<div class="box" id="box1">
<img class="image active" src="https://cdn.shopify.com/s/files/1/0816/4694/4585/files/1st_floor_standard.jpg?v=1713521065" alt="Image 1">
<img class="image" src="https://cdn.shopify.com/s/files/1/0816/4694/4585/files/1st_floor_reverse.jpg?v=1713521065" alt="Image 2">

</div>
<div class="box" id="box2">
<img class="image active" src="https://cdn.shopify.com/s/files/1/0816/4694/4585/files/2nd_floor-standard.jpg?v=1713521065" alt="Image 4">
<img class="image" src="https://cdn.shopify.com/s/files/1/0816/4694/4585/files/2nd_floor_reverse.jpg?v=1713521065" alt="Image 5">

</div>
</div>
</div>

<script>
function toggleImageSet(boxId) {
var activeImage = document.querySelector('#' + boxId + ' .image.active');
var nextImage = activeImage.nextElementSibling;
if (!nextImage) {
nextImage = activeImage.parentElement.firstElementChild;
}
activeImage.classList.remove('active');
nextImage.classList.add('active');
}
</script>
</body>
</html>



Reply 1 (1)

learningdesign
Shopify Partner
126 1 15

Any one ?