ok

Mini Shell

Direktori : /home2/selectio/www/renew-right/
Upload File :
Current File : /home2/selectio/www/renew-right/advance.php

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image Comparison Effect</title>
<style>
  /* CSS Styles */
  .container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
  }

  .row {
    display: flex;
  }

  .col-lg-6 {
    flex: 0 0 50%; /* Half width for large screens */
  }

  .col-md-12 {
    flex: 0 0 100%; /* Full width for medium screens and below */
  }

  .image-container {
    position: relative;
    width: 100%;
    height: auto;
    overflow: hidden;
  }

  .before-image,
  .after-image {
    width: 100%;
    height: auto;
    transition: clip-path 0.5s ease;
    clip-path: inset(0 50% 0 0);
  }

  .slider {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    cursor: ew-resize;
    width: 5px;
    height: 100%;
    background-color: #000;
    opacity: 0.7;
  }
</style>
</head>
<body>

<div class="container">
  <div class="row">
    <div class="col-lg-6 col-md-12">
      <div class="image-container">
        <img class="before-image" src="https://spinnpress.in/wp-content/uploads/2022/08/Before-shoe1.jpg.webp" alt="Before Image">
        <img class="after-image" src="https://spinnpress.in/wp-content/uploads/2022/08/After-shoe1.jpg.webp" alt="After Image">
        <div class="slider"></div>
      </div>
    </div>
  </div>
</div>

<script>
  // JavaScript
  document.addEventListener('DOMContentLoaded', function() {
    const sliders = document.querySelectorAll('.slider');

    sliders.forEach(slider => {
      let isDragging = false;

      slider.addEventListener('mousedown', function(e) {
        isDragging = true;
        this.closest('.image-container').classList.add('dragging');
        updateSliderPosition(e.pageX, this);
      });

      document.addEventListener('mouseup', function() {
        isDragging = false;
        document.querySelectorAll('.image-container').forEach(container => {
          container.classList.remove('dragging');
        });
      });

      document.addEventListener('mousemove', function(e) {
        if (isDragging) {
          updateSliderPosition(e.pageX, slider);
        }
      });
    });

    function updateSliderPosition(x, slider) {
      const rect = slider.closest('.image-container').getBoundingClientRect();
      let posX = x - rect.left;
      posX = Math.max(0, Math.min(posX, rect.width)); // Ensure slider stays within container bounds
      slider.style.left = posX + 'px';
      const ratio = posX / rect.width;
      const afterImage = slider.previousElementSibling;
      afterImage.style.clipPath = `inset(0 ${rect.width - posX}px 0 0)`;
    }
  });
</script>

</body>
</html>

Zerion Mini Shell 1.0