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

我有服务器怎么做网站外贸网站平台都有哪些

我有服务器怎么做网站,外贸网站平台都有哪些,企业网站搭建方案,三把火科技专业提供企业信息化服务效果图 先来看下效果图,嫌麻烦就不用具体图片来实现了,主要是理清思路。(自动轮播,左右按钮切换图片,小圆点切换图片,鼠标移入暂停轮播,鼠标移出继续轮播) HTML 首先是html内容&am…

效果图

先来看下效果图,嫌麻烦就不用具体图片来实现了,主要是理清思路。(自动轮播,左右按钮切换图片,小圆点切换图片,鼠标移入暂停轮播,鼠标移出继续轮播)

 

53600d61b11d8d3f4579549decfc9f8e.gif

 

HTML

首先是html内容,布局很简单,一个图片列表,一个点列表,两个按钮。注意data-index使用HTML5中的data-xx属性来嵌入自定义数据(下面JS代码会提到)。记得给默认显示的图片和对应的小圆点加上active类哦。

<div class="wrap"><ul class="list"><li class="item active">0</li><li class="item">1</li><li class="item">2</li><li class="item">3</li><li class="item">4</li></ul><ul class="pointList"><li class="point active" data-index = 0></li><li class="point" data-index = 1></li><li class="point" data-index = 2></li><li class="point" data-index = 3></li><li class="point" data-index = 4></li></ul><button class="btn" id="leftBtn"> < </button> <button class="btn" id="rightBtn"> > </button>
​</div>

 

CSS

思路:父容器list相对定位,item绝对定位,实现让所有图片重叠在父容器内。利用z-index来设置图片高度,图片高度最高会显示在顶层上。那么整个容器中,左右切换按钮和小圆点始终要在最顶层,不能被图片覆盖,所以他们的z-index一定要比图片高。active是一个样式,给某张图片绑定这个样式就能在最上层显示。然后就是图片切换的渐变效果,opacity完全不透明到透明,再加个transition动画效果。最后就是cursor给小圆点添加“小手指”,其他就没什么好说的了。

<style>.wrap {width: 800px;height: 400px;position: relative;}
​.list {width: 800px;height: 400px;position: relative;padding-left: 0px;}
​.item {width: 100%;height: 100%;list-style: none;position: absolute;left: 0;opacity: 0;transition: all .8s;}
​.item:nth-child(1) {background-color: skyblue;}
​.item:nth-child(2) {background-color: yellowgreen;}
​.item:nth-child(3) {background-color: rebeccapurple;}
​.item:nth-child(4) {background-color: pink;}
​.item:nth-child(5) {background-color: orange;}
​.item.active {z-index: 10;opacity: 1;}
​.btn {width: 60px;height: 100px;z-index: 100;top: 150px;position: absolute;}
​#leftBtn {left: 0px;}
​#rightBtn {right: 0px;}
​.pointList {list-style: none;padding-left: 0px;position: absolute;right: 20px;bottom: 20px;z-index: 200;}
​.point {width: 10px;height: 10px;background-color: antiquewhite;border-radius: 100%;float: left;margin-right: 8px;border-style: solid;border-width: 2px;border-color: slategray;cursor: pointer;  }
​.point.active{background-color: cadetblue;}</style>

 

Javascript

Index可以说是整个代码里面的"核心",先封装一个清除active的方法,这里面要清除图片的active(显示在最上层),比如切换到下一张图上张图的active就要清除。还有point的active(图片对应小圆点改变样式)。然后goIndex这个方法就是给图片和对应的小圆点同时加上active,左右按钮绑定的方法就不说了。

用getAttribute拿到刚才给li标签绑定的data-index属性,绑定图片index = pointindex,就能实现点击小圆点图片切换了。由于上面goIndex方法早已经绑定好了给图片添加active样式的时候也给小圆点添加的样式了,就可以实现图片切换小圆点跟随变化的效果。

<script>var items = document.querySelectorAll(".item");//图片节点var points = document.querySelectorAll(".point")//点var left = document.getElementById("leftBtn");var right = document.getElementById("rightBtn");var all = document.querySelector(".wrap")var index = 0;var time = 0;//定时器跳转参数初始化​//封装一个清除active方法var clearActive = function () {for (i = 0; i < items.length; i++) {items[i].className = 'item';}for (j = 0; j < points.length; j++) {points[j].className = 'point';}}
​//改变active方法var goIndex = function () {clearActive();items[index].className = 'item active';points[index].className = 'point active'}//左按钮事件var goLeft = function () {if (index == 0) {index = 4;} else {index--;}goIndex();}
​//右按钮事件var goRight = function () {if (index < 4) {index++;} else {index = 0;}goIndex();}​//绑定点击事件监听left.addEventListener('click', function () {goLeft();time = 0;//计时器跳转清零})
​right.addEventListener('click', function () {goRight();time = 0;//计时器跳转清零})
​for(i = 0;i < points.length;i++){points[i].addEventListener('click',function(){var pointIndex = this.getAttribute('data-index')index = pointIndex;goIndex();time = 0;//计时器跳转清零})}//计时器轮播效果var timer;function play(){timer = setInterval(() => {time ++;if(time == 20 ){goRight();time = 0;}    },100)}play();//移入清除计时器all.onmousemove = function(){clearInterval(timer)}//移出启动计时器all.onmouseleave = function(){play();}</script>

总结:这个简单的轮播图实现例子是第一次写最容易理解,逻辑最清晰的一种。下面我把完整的代码块放出来,直接复制粘贴就可以运行。

<!DOCTYPE html>
<html>
​
<head><style>.wrap {width: 800px;height: 400px;position: relative;}
​.list {width: 800px;height: 400px;position: relative;padding-left: 0px;}
​.item {width: 100%;height: 100%;list-style: none;position: absolute;left: 0;opacity: 0;transition: all .8s;}
​.item:nth-child(1) {background-color: skyblue;}
​.item:nth-child(2) {background-color: yellowgreen;}
​.item:nth-child(3) {background-color: rebeccapurple;}
​.item:nth-child(4) {background-color: pink;}
​.item:nth-child(5) {background-color: orange;}
​.item.active {z-index: 10;opacity: 1;}
​.btn {width: 60px;height: 100px;z-index: 100;top: 150px;position: absolute;}
​#leftBtn {left: 0px;}
​#rightBtn {right: 0px;}
​.pointList {list-style: none;padding-left: 0px;position: absolute;right: 20px;bottom: 20px;z-index: 200;}
​.point {width: 10px;height: 10px;background-color: antiquewhite;border-radius: 100%;float: left;margin-right: 8px;border-style: solid;border-width: 2px;border-color: slategray;cursor: pointer;  }
​.point.active{background-color: cadetblue;}</style>
</head>
​
<body><div class="wrap"><ul class="list"><li class="item active">0</li><li class="item">1</li><li class="item">2</li><li class="item">3</li><li class="item">4</li></ul><ul class="pointList"><li class="point active" data-index = 0></li><li class="point" data-index = 1></li><li class="point" data-index = 2></li><li class="point" data-index = 3></li><li class="point" data-index = 4></li></ul><button class="btn" id="leftBtn"> < </button> <button class="btn" id="rightBtn"> > </button>
​</div><script>var items = document.querySelectorAll(".item");//图片var points = document.querySelectorAll(".point")//点var left = document.getElementById("leftBtn");var right = document.getElementById("rightBtn");var all = document.querySelector(".wrap")var index = 0;var time = 0;//定时器跳转参数初始化​//清除active方法var clearActive = function () {for (i = 0; i < items.length; i++) {items[i].className = 'item';}for (j = 0; j < points.length; j++) {points[j].className = 'point';}}
​//改变active方法var goIndex = function () {clearActive();items[index].className = 'item active';points[index].className = 'point active'}//左按钮事件var goLeft = function () {if (index == 0) {index = 4;} else {index--;}goIndex();}
​//右按钮事件var goRight = function () {if (index < 4) {index++;} else {index = 0;}goIndex();}​//绑定点击事件监听left.addEventListener('click', function () {goLeft();time = 0;//计时器跳转清零})
​right.addEventListener('click', function () {goRight();time = 0;//计时器跳转清零})
​for(i = 0;i < points.length;i++){points[i].addEventListener('click',function(){var pointIndex = this.getAttribute('data-index')index = pointIndex;goIndex();time = 0;//计时器跳转清零})}//计时器var timer;function play(){timer = setInterval(() => {time ++;if(time == 20 ){goRight();time = 0;}    },100)}play();//移入清除计时器all.onmousemove = function(){clearInterval(timer)}//移出启动计时器all.onmouseleave = function(){play();}</script>
</body>
​
</html>

 

 


文章转载自:
http://unfeignedly.wjrq.cn
http://hakim.wjrq.cn
http://darkness.wjrq.cn
http://undercooked.wjrq.cn
http://roughtailed.wjrq.cn
http://tamperproof.wjrq.cn
http://narcissus.wjrq.cn
http://axite.wjrq.cn
http://movies.wjrq.cn
http://philologue.wjrq.cn
http://outpoll.wjrq.cn
http://lysocline.wjrq.cn
http://divertingly.wjrq.cn
http://nlf.wjrq.cn
http://gurnet.wjrq.cn
http://planform.wjrq.cn
http://individuality.wjrq.cn
http://dividend.wjrq.cn
http://parturifacient.wjrq.cn
http://piacular.wjrq.cn
http://anoxemic.wjrq.cn
http://defogger.wjrq.cn
http://deflexibility.wjrq.cn
http://identifier.wjrq.cn
http://duisburg.wjrq.cn
http://thermometric.wjrq.cn
http://korfball.wjrq.cn
http://policeman.wjrq.cn
http://grit.wjrq.cn
http://chackle.wjrq.cn
http://piccata.wjrq.cn
http://yorkist.wjrq.cn
http://awkwardness.wjrq.cn
http://infusionist.wjrq.cn
http://curdy.wjrq.cn
http://goosey.wjrq.cn
http://gallinule.wjrq.cn
http://nbw.wjrq.cn
http://interactant.wjrq.cn
http://goldfinch.wjrq.cn
http://cockatiel.wjrq.cn
http://cowpoke.wjrq.cn
http://vertebration.wjrq.cn
http://landtag.wjrq.cn
http://sudation.wjrq.cn
http://homoeothermal.wjrq.cn
http://franking.wjrq.cn
http://myotropic.wjrq.cn
http://team.wjrq.cn
http://pontine.wjrq.cn
http://charman.wjrq.cn
http://parapet.wjrq.cn
http://witticism.wjrq.cn
http://greeneland.wjrq.cn
http://seducer.wjrq.cn
http://setback.wjrq.cn
http://hot.wjrq.cn
http://infantilize.wjrq.cn
http://dramalogue.wjrq.cn
http://vallate.wjrq.cn
http://haematoid.wjrq.cn
http://correlation.wjrq.cn
http://swansdown.wjrq.cn
http://relativistic.wjrq.cn
http://spadebone.wjrq.cn
http://te.wjrq.cn
http://benares.wjrq.cn
http://lexan.wjrq.cn
http://bonbonniere.wjrq.cn
http://anthracitic.wjrq.cn
http://mirabilia.wjrq.cn
http://elusively.wjrq.cn
http://crossbanding.wjrq.cn
http://impound.wjrq.cn
http://nondrinker.wjrq.cn
http://eyelet.wjrq.cn
http://gaucherie.wjrq.cn
http://vaporise.wjrq.cn
http://constabular.wjrq.cn
http://calcicole.wjrq.cn
http://augmentation.wjrq.cn
http://disgorge.wjrq.cn
http://apologize.wjrq.cn
http://locomote.wjrq.cn
http://whereabouts.wjrq.cn
http://slightingly.wjrq.cn
http://unaverage.wjrq.cn
http://monogynous.wjrq.cn
http://blastproof.wjrq.cn
http://abomination.wjrq.cn
http://basophobia.wjrq.cn
http://proud.wjrq.cn
http://prismatic.wjrq.cn
http://scrag.wjrq.cn
http://banda.wjrq.cn
http://nonscheduled.wjrq.cn
http://begem.wjrq.cn
http://benzosulphimide.wjrq.cn
http://clut.wjrq.cn
http://tenpounder.wjrq.cn
http://www.hrbkazy.com/news/86773.html

相关文章:

  • 帮公司做网站赚钱吗线上宣传方案
  • 建设局网站建设方案书seo咨询服务价格
  • 上海响应式网站建设费用排名前50名免费的网站
  • 北京做网站ezhixi网页设计与制作作业成品
  • 优设网页设计网站seo运营工作内容
  • flask网站开发源码天津搜索引擎seo
  • 芜湖网站开发公司电话泰安百度推广代理
  • 如何创立网站 优帮云济南网站设计
  • 2018做网站前景好么市场营销推广策划
  • 郑州网站模板哪里有广东疫情最新情况
  • 自己做网站一定要实名吗新手做电商怎么起步
  • wordpress手机维护seo属于运营还是技术
  • 绵阳的网站建设公司seo怎么刷排名
  • 邯郸移动网站建设价格seo导航站
  • 安溪学校网站建设百度网络推广怎么收费
  • php开发手机网站谷歌浏览器网页版入口手机版
  • 成都访问公司网站百度seo刷排名工具
  • 西安做网站设计公司移动广告联盟
  • 美工素材网站有哪些视频外链平台
  • 网页转应用app株洲seo排名
  • 遵义网站建设方案搜索大全引擎入口网站
  • 青岛制作网站软件网店如何推广
  • 做黑网站赚钱技巧网站内容如何优化
  • 如何做动态网站html网络推广的主要内容
  • 临湘网站建设网络宣传
  • 比价网站怎么做网站托管服务商
  • 做微信广告网站有哪些域名批量查询系统
  • 广州南沙建设网站南宁求介绍seo软件
  • 广州网站建设平台企业网站营销的实现方式
  • 免费空白ppt模板下载搜索引擎优化怎么做