0


炫酷的花式滑块滑动无缝切换特效

  • 💂 个人网站:【 海拥】【小霸王游戏机】【大转盘】
  • 🤟 风趣幽默的前端学习课程:👉28个案例趣学前端
  • 💅 想寻找共同学习交流、摸鱼划水的小伙伴,请点击【摸鱼学习群】【学习文档】
  • 💬 免费且实用的计算机相关知识题库:👉进来逛逛

给大家安利一个免费且实用的前端刷题(面经大全)网站,👉点击跳转到网站。

在线演示地址https://haiyong.site/moban/texiao/1/
源码下载地址http://43.142.11.221/125/

✨ 项目基本结构

目录结构如下:

├── css
│   └── style.css
├── js
│   └── script.js
└── index.html

本节教程我会带大家使用 HTML 、CSS和 JS 来制作一个 炫酷的花式滑块滑动无缝切换特效

本节示例将会实现如下所示的效果:

在这里插入图片描述
下面让我们一起来实现吧!

HTML

HTML中

<body></body>

内的代码:

<divclass="demo-cont"><!-- slider start --><divclass="fnc-slider example-slider"><divclass="fnc-slider__slides"><!-- slide start --><divclass="fnc-slide m--blend-green m--active-slide"><divclass="fnc-slide__inner"><divclass="fnc-slide__mask"><divclass="fnc-slide__mask-inner"></div></div><divclass="fnc-slide__content"><h2class="fnc-slide__heading"><divclass="fnc-slide__heading-line"><span>Black</span></div><divclass="fnc-slide__heading-line"><span>Widow</span></div></h2><buttontype="button"class="fnc-slide__action-btn">
              Credits
              <spandata-text="Credits">Credits</span></button></div></div></div><!-- slide end --><!-- slide start --><divclass="fnc-slide m--blend-dark"><divclass="fnc-slide__inner"><divclass="fnc-slide__mask"><divclass="fnc-slide__mask-inner"></div></div><divclass="fnc-slide__content"><h2class="fnc-slide__heading"><divclass="fnc-slide__heading-line"><span>Captain</span></div><divclass="fnc-slide__heading-line"><span>America</span></div></h2><buttontype="button"class="fnc-slide__action-btn">
              Credits
              <spandata-text="Credits">Credits</span></button></div></div></div><!-- slide end --><!-- slide start --><divclass="fnc-slide m--blend-red"><divclass="fnc-slide__inner"><divclass="fnc-slide__mask"><divclass="fnc-slide__mask-inner"></div></div><divclass="fnc-slide__content"><h2class="fnc-slide__heading"><divclass="fnc-slide__heading-line"><span>Iron</span></div><divclass="fnc-slide__heading-line"><span>Man</span></div></h2><buttontype="button"class="fnc-slide__action-btn">
              Credits
              <spandata-text="Credits">Credits</span></button></div></div></div><!-- slide end --><!-- slide start --><divclass="fnc-slide m--blend-blue"><divclass="fnc-slide__inner"><divclass="fnc-slide__mask"><divclass="fnc-slide__mask-inner"></div></div><divclass="fnc-slide__content"><h2class="fnc-slide__heading"><divclass="fnc-slide__heading-line"><span>Thor</span></div><divclass="fnc-slide__heading-line"><span>Just Thor</span></div></h2><buttontype="button"class="fnc-slide__action-btn">
              Credits
              <spandata-text="Credits">Credits</span></button></div></div></div><!-- slide end --></div><navclass="fnc-nav"><divclass="fnc-nav__bgs"><divclass="fnc-nav__bg m--navbg-green m--active-nav-bg"></div><divclass="fnc-nav__bg m--navbg-dark"></div><divclass="fnc-nav__bg m--navbg-red"></div><divclass="fnc-nav__bg m--navbg-blue"></div></div><divclass="fnc-nav__controls"><buttonclass="fnc-nav__control">
          Black Widow
          <spanclass="fnc-nav__control-progress"></span></button><buttonclass="fnc-nav__control">
          Captain America
          <spanclass="fnc-nav__control-progress"></span></button><buttonclass="fnc-nav__control">
          Iron Man
          <spanclass="fnc-nav__control-progress"></span></button><buttonclass="fnc-nav__control">
          Thor
          <spanclass="fnc-nav__control-progress"></span></button></div></nav></div><!-- slider end --><divclass="demo-cont__credits"><divclass="demo-cont__credits-close"></div><h2class="demo-cont__credits-heading">Made by</h2><imgsrc="//s3-us-west-2.amazonaws.com/s.cdpn.io/142996/profile/profile-512_5.jpg"alt=""class="demo-cont__credits-img"/><h3class="demo-cont__credits-name">Nikolay Talanov</h3><ahref="https://codepen.io/suez/"target="_blank"class="demo-cont__credits-link">My codepen</a><ahref="https://twitter.com/NikolayTalanov"target="_blank"class="demo-cont__credits-link">My twitter</a><h2class="demo-cont__credits-heading">Based on</h2><ahref="https://dribbble.com/shots/2375246-Fashion-Butique-slider-animation"target="_blank"class="demo-cont__credits-link">Concept by Kreativa Studio</a><h4class="demo-cont__credits-blend">Global Blend Mode</h4><divclass="colorful-switch"><inputtype="checkbox"class="colorful-switch__checkbox js-activate-global-blending"id="colorful-switch-cb"/><labelclass="colorful-switch__label"for="colorful-switch-cb"><spanclass="colorful-switch__bg"></span><spanclass="colorful-switch__dot"></span><spanclass="colorful-switch__on"><spanclass="colorful-switch__on__inner"></span></span><spanclass="colorful-switch__off"></span></label></div></div></div>

CSS

部分 CSS 代码:

.fnc {
  /* you can add color names and their values here
  and then simply add classes like .m--blend-$colorName to .fnc-slide 
  to apply specific color for mask blend mode */
}
.fnc-slider {
  overflow: hidden;
  box-sizing: border-box;
  position: relative;
  height: 100vh;
}
.fnc-slider *, .fnc-slider *:before, .fnc-slider *:after {
  box-sizing: border-box;
}
.fnc-slider__slides {
  position: relative;
  height: 100%;
  transition: transform 1s 0.6666666667s;
}
.fnc-slider .m--blend-dark .fnc-slide__inner {
  background-color: #8a8a8a;
}
.fnc-slider .m--blend-dark .fnc-slide__mask-inner {
  background-color: #575757;
}
.fnc-slider .m--navbg-dark {
  background-color: #575757;
}
.fnc-slider .m--blend-green .fnc-slide__inner {
  background-color: #6d9b98;
}
.fnc-slider .m--blend-green .fnc-slide__mask-inner {
  background-color: #42605E;
}
.fnc-slider .m--navbg-green {
  background-color: #42605E;
}
.fnc-slider .m--blend-red .fnc-slide__inner {
  background-color: #ea2329;
}
.fnc-slider .m--blend-red .fnc-slide__mask-inner {
  background-color: #990e13;
}
.fnc-slider .m--navbg-red {
  background-color: #990e13;
}
.fnc-slider .m--blend-blue .fnc-slide__inner {
  background-color: #59aecb;
}
.fnc-slider .m--blend-blue .fnc-slide__mask-inner {
  background-color: #2D7791;
}
.fnc-slider .m--navbg-blue {
  background-color: #2D7791;
}
.fnc-slide {
  overflow: hidden;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  transform: translate3d(0, 0, 0);
}

JS

部分JS代码:

fncSlider(".example-slider",{autoSlidingDelay:4000});var $demoCont = document.querySelector(".demo-cont");[].slice.call(document.querySelectorAll(".fnc-slide__action-btn")).forEach(function($btn){
  $btn.addEventListener("click",function(){
    $demoCont.classList.toggle("credits-active");});});

document.querySelector(".demo-cont__credits-close").addEventListener("click",function(){
  $demoCont.classList.remove("credits-active");});

document.querySelector(".js-activate-global-blending").addEventListener("click",function(){
  document.querySelector(".example-slider").classList.toggle("m--global-blending-active");});

到此,仿 GitHub 登录页面的效果就实现啦!

📑 完整源码下载⬇

到此我们的产品展示界面就完成了,本实验的完整代码已上传,下载地址:

http://43.142.11.221/125/

⭐️ 好书推荐

《人工智能导论》

在这里插入图片描述

【内容简介】

**科大讯飞校企合编教材,涵盖人工智能各个重要体系,详解人工智能基础理论,详细解读算法逻辑:详解机器学习、人工神经网络、智能语音识别、自然语言处理、知识图谱与机器人等核心算法知识,清晰介绍实战步骤:有理论有实战,介绍了人工智能算法与技术的实际应用,步骤清楚,条理清晰,即学即用。
**

📚 京东自营购买链接:《人工智能导论》

标签: 前端

本文转载自: https://blog.csdn.net/qq_44273429/article/details/127137754
版权归原作者 海拥✘ 所有, 如有侵权,请联系我们删除。

“炫酷的花式滑块滑动无缝切换特效”的评论:

还没有评论