HTML, CSS3, JS 制作剪辑路径圆形图像滑块设计id1131-网页设计


Warning: Undefined property: stdClass::$maxbutton id="5" in /www/wwwroot/code.5g-o.com/wp-content/plugins/kama-clic-counter/class.KCCounter.php on line 733
在线演示  
  <html >
<head>
  <meta charset="UTF-8">
  <title>Clip-Path Revealing Slider</title>
  <link href="https://fonts.googleapis.com/css?family=Oswald&display=swap" rel="stylesheet">
  <style>
    *, *:before, *:after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  overflow: hidden;
  font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
}

.slider {
  position: relative;
  height: 100vh;
}
.slider__slides {
  z-index: 1;
  position: relative;
  height: 100%;
}
.slider__control {
  z-index: 2;
  position: absolute;
  top: 50%;
  left: 5%;
  width: 60px;
  height: 60px;
  margin-left: -30px;
  margin-top: -30px;
  border-radius: 50%;
  background: #fff;
  -webkit-transition: background-color 0.3s;
  transition: background-color 0.3s;
  cursor: pointer;
}
.slider__control--right {
  left: 95%;
}
.slider__control:hover {
  background-color: #2da6ff;
}
.slider__control-line {
  position: absolute;
  left: 23px;
  top: 50%;
  width: 3px;
  height: 14px;
  -webkit-transform-origin: 50% 0;
          transform-origin: 50% 0;
  -webkit-transform: rotate(-45deg);
          transform: rotate(-45deg);
}
.slider__control-line:nth-child(2) {
  -webkit-transform: translateY(1px) rotate(-135deg);
          transform: translateY(1px) rotate(-135deg);
}
.slider__control--right .slider__control-line {
  left: 37px;
  -webkit-transform-origin: 1px 0;
          transform-origin: 1px 0;
  -webkit-transform: rotate(45deg);
          transform: rotate(45deg);
}
.slider__control--right .slider__control-line:nth-child(2) {
  -webkit-transform: translateY(1px) rotate(135deg);
          transform: translateY(1px) rotate(135deg);
}
.slider__control-line:after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: #e2e2e2;
  -webkit-transition: background-color 0.3s;
  transition: background-color 0.3s;
}
.slider__control:hover .slider__control-line:after {
  background-color: #fff;
}
.slider__control.a--rotation .slider__control-line:after {
  -webkit-animation: arrowLineRotation 0.49s;
          animation: arrowLineRotation 0.49s;
}
.slider__control.a--rotation .slider__control-line:nth-child(1):after {
  -webkit-animation: arrowLineRotationRev 0.49s;
          animation: arrowLineRotationRev 0.49s;
}

@-webkit-keyframes arrowLineRotation {
  to {
    -webkit-transform: rotate(180deg);
            transform: rotate(180deg);
  }
}

@keyframes arrowLineRotation {
  to {
    -webkit-transform: rotate(180deg);
            transform: rotate(180deg);
  }
}
@-webkit-keyframes arrowLineRotationRev {
  to {
    -webkit-transform: rotate(-180deg);
            transform: rotate(-180deg);
  }
}
@keyframes arrowLineRotationRev {
  to {
    -webkit-transform: rotate(-180deg);
            transform: rotate(-180deg);
  }
}
.slide {
  overflow: hidden;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 150vmax;
  height: 150vmax;
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
  border-radius: 50%;
  -webkit-transition: -webkit-clip-path 0s 0.91s;
  transition: -webkit-clip-path 0s 0.91s;
  transition: clip-path 0s 0.91s;
  transition: clip-path 0s 0.91s, -webkit-clip-path 0s 0.91s;
  -webkit-clip-path: circle(30px at 120vw 50%);
          clip-path: circle(30px at 120vw 50%);
}
.slide.s--prev {
  -webkit-clip-path: circle(30px at 30vw 50%);
          clip-path: circle(30px at 30vw 50%);
}
.slide.s--active {
  z-index: 1;
  -webkit-transition: -webkit-clip-path 1.3s;
  transition: -webkit-clip-path 1.3s;
  transition: clip-path 1.3s;
  transition: clip-path 1.3s, -webkit-clip-path 1.3s;
  -webkit-clip-path: circle(120vmax at 120vw 50%);
          clip-path: circle(120vmax at 120vw 50%);
}
.slide.s--active.s--active-prev {
  -webkit-clip-path: circle(120vmax at 30vw 50%);
          clip-path: circle(120vmax at 30vw 50%);
}
.slide:nth-child(1) .slide__inner {
  background-image: url(blue-2564660_1920.jpg);
}
.slide:nth-child(2) .slide__inner {
  background-image: url(blue-bricks-door-845242.jpg);
}
.slide:nth-child(3) .slide__inner {
  background-image: url(cody-davis-253928-unsplash.jpg);
}
.slide:nth-child(4) .slide__inner {
  background-image: url(pinguin-1920x1080-snow-ocean-cute-animals-funny-4457.jpg);
}
.slide:nth-child(5) .slide__inner {
  background-image: url(vincent-giersch-100507-unsplash.jpg);
}
.slide__inner {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100vw;
  height: 100vh;
  margin-left: -50vw;
  margin-top: -50vh;
  background-size: cover;
  background-position: center center;
}
.slide__inner:before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
   
}
.slide__content {
  position: absolute;
  left: 5%;
  top: 50%;
  margin-left: -30px;
  margin-top: 48px;
  max-width: 480px;
  color: #fff;
}
.slide__heading {
  margin-bottom: 20px;
  font-size: 60px;
}
.slide__text {
  font-size: 25px;
}
.slide__text a {
  color: inherit;
}

    </style>
   
</head>

<body>
  <div class="slider">
  <!-- slides -->
  <div class="slider__slides">
    <div class="slide s--active">
      <div class="slide__inner">
        <div class="slide__content">
          <h2 class="slide__heading">Clip-Path circular Slider</h2>
          <p class="slide__text">Cheers now</p>
        </div>
      </div>
    </div>
    <div class="slide">
      <div class="slide__inner">
        <div class="slide__content">
          <h2 class="slide__heading">Creative Slider</h2>
          <p class="slide__text">Clip-path magic!</p>
        </div>
      </div>
    </div>
    <div class="slide">
      <div class="slide__inner">
        <div class="slide__content">
          <h2 class="slide__heading">Very Professional Effect</h2>
          <p class="slide__text">It looks wow, isn't it?</p>
        </div>
      </div>
    </div>
    <div class="slide">
      <div class="slide__inner">
        <div class="slide__content">
          <h2 class="slide__heading">Limited edition design</h2>
          <p class="slide__text">Which makes the web wow</p>
        </div>
      </div>
    </div>
    <div class="slide s--prev">
      <div class="slide__inner">
            <div class="slide__inner">
        <div class="slide__content">
          <h2 class="slide__heading">Clip-Path Circular Slider</h2>
          <p class="slide__text">Greetings, Traveler!</p>
        </div>
      </div>
      </div>
    </div>
  </div>
  <!-- slides end -->
  <div class="slider__control">
    <div class="slider__control-line"></div>
    <div class="slider__control-line"></div>
  </div>
  <div class="slider__control slider__control--right m--right">
    <div class="slider__control-line"></div>
    <div class="slider__control-line"></div>
  </div>
</div>
   <script>
    (function() {
  var $slides = document.querySelectorAll('.slide');
  var $controls = document.querySelectorAll('.slider__control');
  var numOfSlides = $slides.length;
  var slidingAT = 1300; // sync this with scss variable
  var slidingBlocked = false;

  [].slice.call($slides).forEach(function($el, index) {
    var i = index + 1;
    $el.classList.add('slide-' + i);
    $el.dataset.slide = i;
  });

  [].slice.call($controls).forEach(function($el) {
    $el.addEventListener('click', controlClickHandler);
  });

  function controlClickHandler() {
    if (slidingBlocked) return;
    slidingBlocked = true;

    var $control = this;
    var isRight = $control.classList.contains('m--right');
    var $curActive = document.querySelector('.slide.s--active');
    var index = +$curActive.dataset.slide;
    (isRight) ? index++ : index--;
    if (index < 1) index = numOfSlides;
    if (index > numOfSlides) index = 1;
    var $newActive = document.querySelector('.slide-' + index);

    $control.classList.add('a--rotation');
    $curActive.classList.remove('s--active', 's--active-prev');
    document.querySelector('.slide.s--prev').classList.remove('s--prev');
    
    $newActive.classList.add('s--active');
    if (!isRight) $newActive.classList.add('s--active-prev');
    

    var prevIndex = index - 1;
    if (prevIndex < 1) prevIndex = numOfSlides;

    document.querySelector('.slide-' + prevIndex).classList.add('s--prev');

    setTimeout(function() {
      $control.classList.remove('a--rotation');
      slidingBlocked = false;
    }, slidingAT*0.75);
  };
}());
    </script>
</body>
clip.html
</html>  

在线演示


让链接同时具备两种打开方式
获取源码: CLIP PATH
下载数:251人次, 文件大小: 1.0 MB, 上传日期: 2020年-12月-13日

公众号回复:gcode  获取解压密码

qrcode_for_gh_6ea2c28a1709_258 (1)

2,991 人查阅

一键获取本网站前端代码设计的所有源码

获取资源构建和完善自己的源码库
源码可以在本地直接演示
同时研究和体验 如何将一些具体的想法的实现过程
源码可以直接嫁接到自己的网站里复用
稍作修改成为自己的作品
下载 (4)

您需要先支付 6元 才能查看此处内容!立即支付

类似文章