jQuery带顺序列表图片切换

 时间:2024-11-03 22:52:27

1、准备好需要用到的图标。

jQuery带顺序列表图片切换

2、新建html文档。

jQuery带顺序列表图片切换

3、书写hmtl代码。<div id='banner'></div>

jQuery带顺序列表图片切换

4、书写css代码。.pull-left { float: left!important; }.pull-right { float: right!important; }.clearfix:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; }.clearfix { display: inline-block; }* html .clearfix { height: 1%; }.clearfix { display: block; }ul, li { margin: 0; padding: 0; list-style-type: none; }.carousel-box { position: relative; width: 100%; }.transverse-box { position: relative; width: 66.7%; }.img-item { position: absolute; top: 0; left: 0; z-index: 0; }.vertical-box { position: relative; width: 33.3%; }.vertical-box ul { overflow: hidden; }.img-item { transition: width 1s; }.img-item img { width: 100%; height: 100%; }.vertical-box ul li { font-size: 0; }.vertical-box ul li img { width: 100%; height: 100%; }.left-arrow { display: flex; justify-content: center; align-items: center; position: absolute; top: 50%; left: 0px; color: #fff; margin-top: -35px; font-size: 50px; font-weight: 200; text-align: center; line-height: 100px; width: 50px; height: 70px; background: rgba(0,0,0,0.6); cursor: pointer; z-index: 99; }.right-arrow { display: flex; justify-content: center; align-items: center; position: absolute; top: 50%; right: 0px; color: #fff; margin-top: -35px; font-size: 50px; font-weight: 200; text-align: center; line-height: 100px; width: 50px; height: 70px; background: rgba(0,0,0,0.6); cursor: pointer; z-index: 99; }

jQuery带顺序列表图片切换

5、书写并添加js代码。<script src="js/jquery.min.js"></script><script src='js/carousel.js'></script><script> window.onload = function(){ var banner = new Carousel(); //图片地址数组。不要少于三张 var imgSrcDate = ["img/a1.png","img/a2.png","img/a3.png","img/a4.png","img/a5.png","img/a6.png"]; banner.init({ container:"#banner", datas:imgSrcDate, autoplaySpeed:5000, autoplay:false }); }</script>

jQuery带顺序列表图片切换

6、代码整体结构。

jQuery带顺序列表图片切换

7、查看效果。

jQuery带顺序列表图片切换
  • jQuery点击按钮切换网页背景图片
  • jQuery网站打开之后幻灯片随机切换
  • jquery如何实现点击按钮文本内容的切换
  • 新闻列表jQuery上下点击翻转列表
  • 怎样用javascript实现图片定时切换
  • 热门搜索
    我爱读书手抄报内容 英语手抄报内容大全 关于写字的手抄报 关于战争的手抄报 小学生诚信手抄报 让妈妈露笑脸手抄报 创建森林城市手抄报 英语节日手抄报 关于法制的手抄报资料 食品手抄报