My website has a unique concept - comparing two articles side by side. One of the articles is mine, while the other is displayed alongside it.
To capture entire pages for comparison, I utilize Google's GoFullPage feature to take screenshots.
The goal is to zoom in on each paragraph individually so that viewers can see corresponding paragraphs from both articles clearly.
In my attempts to achieve this effect, I initially used offset: path()
with a transition on the width attribute. However, this resulted in an unintended rotation of the screenshot, displaying it horizontally regardless of the width attribute adjustment.
Subsequently, adding a transition to the top: 0;
attribute came close to the desired effect.
Finally, I experimented with applying a transition using two negative margins: margin-top: -20%
& margin-bottom: -20%
. Though successful in the upper areas of the screenshot, this method posed a challenge as the negative margin values persisted.
Despite various attempts with negative margins, none seemed to produce the desired zoom effect effectively.
Looking into alternative solutions, I discovered the existence of a zoom
property. Could this potentially offer the effect I am seeking? Perhaps JavaScript could provide a better alternative?
Below is the code snippet:
body {
overflow-x: hidden;
}
.drag-container {
display: flex;
min-height: 100vh;
}
[class^="panel"] {
padding: 0px 0px;
background-color: white;
}
.panel-one {
width: 48.9%;
}
.panel-two {
flex: 1;
width: 52.1%;
}
.dragbar {
position: relative;
padding: 2px;
cursor: pointer;
background-color: rgb(25, 0, 75);
}
.slider {
position: relative;
z-index: 9;
cursor: pointer;
/*set the appearance of the slider:*/
width: 40px;
height: 40px;
}
.reference-image {
position: relative;
width: 100%;
height: 100%;
transition-property: width , top , margin-top;
transition-duration: 1s;
margin-top: 0;
margin-bottom: 0;
}
.reference-image:hover {
width: 179.1%;
margin-top: -20%;
margin-bottom: -20%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" ; href="COPY.css">
<title>History of Africa</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
text-align: center;
}
</style>
</head>
<body>
<!-- DRAG BAR (IMAGE) -->
<div class="drag-container">
<div class="panel-one" ; id="drag-left">
<img src="https://i.sstatic.net/QSr5pLZn.png" ; style="display: block; width: 100%;">
<h1 style="text-decoration: underline;">Safkfsdf Akslefos Alpsdfd</h1>
<br>
<br>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Ullam reprehenderit modi eius
numquam.Quia saepe nulla aliquid nesciunt et a pariatur expedita mollitia. Suscipit
necessitatibus temporibus architecto ea rerum eveniet.
Vitae quis sint tenetur impedit corrupti esse error amet minima enim. Eos quas similique
aperiam itaque autem. Veritatis optio deleniti, deserunt animi soluta, nam ab aut maxime
inventore quis voluptate.
Ipsam, corporis earum. Ipsa quasi ipsum eius, dolor dolore assumenda! Eum quod fugit iste
dignissimos exercitationem libero, numquam reprehenderit, rerum totam, delectus expedita
voluptas nam unde! Magnam corrupti ratione amet.
Quaerat quasi qui pariatur earum nobis velit, nemo consectetur laborum tenetur sed! Modi
ipsa temporibus mollitia dolor inventore. Sapiente molestias alias nesciunt! Dolor non
quas soluta eaque repellendus enim ipsam.
</p>
</div>
<div class="dragbar" ; id="dragbar">
<div class="slider"></div>
</div>
<div class="panel-two" ; id="drag-right">
<img class="reference-image" ; src="https://i.sstatic.net/jN8q6WFd.png" ; width="100%" ; height="100%">
</div>
</div>
</body>
</html>