当前位置: 首页 > news >正文

swiper.js实现名录上下滚动

实现效果如下:

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/5.4.5/css/swiper.css"><script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/5.4.5/js/swiper.js"></script><link rel="stylesheet" type="text/css" href="./css/style.css"></head><body><div class="container"><div class="swiper"><ul class="list-wrapper swiper-wrapper"><li class="list-content swiper-slide"><div class="list-inner"><div class="name">王启龙1</div><div class="company">深圳市港龙混南通有限公司</div><div class="job">董事长</div></div></li><li class="list-content swiper-slide"><div class="list-inner"><div class="name">王启龙2</div><div class="company">深圳市港龙混南通有限公司</div><div class="job">董事长</div></div></li></ul></div></div>
</body><script>var mySwiper = new Swiper('.swiper', {direction: 'vertical', // 垂直切换选项loop: true, // 循环模式选项loopPreventsSlide: true,//当swiper 正在过渡时,阻止slide 前进后退的切换操作observer: true,observeParents: true,slidesPerView: 10, //swiper容器同时展示的元素数量spaceBetween: 0, //元素之间间隔距离speed: 2000,  //slider自动滑动开始到结束的时间autoplay: {//开启自动切换delay: 0,//自动切换的时间间隔stopOnLastSlide: false,//当切换到最后一个slide时停止自动切换disableOnInteraction: false,//用户操作swiper之后,是否停止自动切换效果},})   
</script></html>
*{margin: 0;padding: 0;box-sizing: border-box; font-size: 14px;
}
a {color: #000;text-decoration: none;display: inline-block;
}
ul{list-style: none;
}
ul li{list-style: none;
}
body{background: #fff;background-image:url('../img/bg.png');background-size: 100%;background-repeat: no-repeat;
}
.container{width: 1200px;margin: 0 auto;margin-top: 220px;padding-bottom: 50px;overflow: hidden;height:500px;
}
.swiper{height: 300px;border: 1px solid #ccc;overflow: hidden;
}
.list-wrapper{height: 100%;}
.list-inner{border-bottom: 1px solid #ccc;clear: both;height: 30px;line-height:30px;display: block;color: #fff;font-size: 16px;}.list-inner .name{float: left;width: 150px;border-right: 1px solid #fff;padding-left: 10px;
}
.list-inner .company{width:auto;float: left;padding: 0px 10px;}
.list-inner  .job{float: right;width: 150px;border-left: 1px solid #fff;padding: 0px 10px;
}
.swiper-wrapper {  transition-timing-function:linear !important;-webkit-transition-timing-function: linear !important;   -moz-transition-timing-function: linear !important;-ms-transition-timing-function: linear !important;-o-transition-timing-function: linear !important;transition-timing-function: linear !important;}

http://www.lryc.cn/news/600127.html

相关文章:

  • Python 条件分支与循环详解--python004
  • 【Agent】API Reference Manual(API 参考手册)
  • 【Spring AI详解】开启Java生态的智能应用开发新时代(附不同功能的Spring AI实战项目)
  • 手写A2C(FrozenLake环境)
  • 牛客刷题记录01
  • 【C++】二叉搜索数
  • 流式接口,断点续传解决方案及实现
  • QKV 为什么是三个矩阵?注意力为何要除以 √d?多头注意力到底有啥用?
  • 【PyTorch】图像多分类项目
  • jwt 在net9.0中做身份认证
  • qt框架,使用webEngine如何调试前端
  • 开发笔记 | 优化对话管理器脚本与对话语音的实现
  • 13.使用C连接mysql
  • Jenkins中出现pytest: error: unrecognized arguments: --alluredir=report错误解决办法
  • 栈----1.有效的括号
  • 机器学习 KNN 算法,鸢尾花案例
  • 从Taro的Dialog.open出发,学习远程控制组件之【事件驱动】
  • C++ 多线程同步机制详解:互斥锁、条件变量与原子操作
  • Python Multiprocessing 进程池完全教程:从理论到实战
  • 数据结构(3)单链表
  • [尚庭公寓]14-找房模块
  • Canal 1.1.7的安装
  • 习题5.6 “数学黑洞“
  • PHP插件开发中的一个错误:JSON直接输出导致网站首页异常
  • 纸板留声机:用ESP32和NFC打造会唱歌的复古装置
  • 手语式映射:Kinova Gen3 力控机械臂自适应控制的研究与应用
  • 秒收蜘蛛池解析机制的原理
  • PPIO上线阿里旗舰推理模型Qwen3-235B-A22B-Thinking-2507
  • ATR2652SGNSS全频段低噪声放大器
  • PostgreSQL对象权限管理