考虑下面的html代码,帮忙写下下面的HTML代码,谢谢

3a86fbd2195faadf221349220383d9f4.png

千秋此意

html>

tabview

* { margin: 0; padding: 0; list-style: none; }

.tab { width: 500px; height: 300px; margin: 100px auto; text-align: center; position: relative; overflow: hidden; }

.con { width: 100%; height: 100%; position: relative; transition: all .4s ease; overflow: hidden; }

.con li { width: 500px; height: 100%; background-color: #424b50; color: #f3f8f1; line-height: 300px; float: left; }

.nav { width: 100%; height: 30px; position: absolute; bottom: 0; left: 0; overflow: hidden; text-align: center; }

.nav li { width: 20px; height: 20px; background-color: #f3f8f1; display: inline-block; border-radius: 50%; color: #424b50; cursor: pointer; }

.nav li.ac { background-color: #9d2932; color: #f3f8f1; }

  • item 001
  • item 002
  • item 003
  • item 004
  • item 005
  • 1
  • 2
  • 3
  • 4
  • 5

var oTab = document.querySelector('.tab'),

oCon = oTab.querySelector('.con'),

aNav = oTab.querySelectorAll('.nav li'),

iNow = 0;

oCon.style.width = oTab.offsetWidth * aNav.length + 'px';

for (var i = 0; i 

!function(index){

aNav[i].onclick = function(){

iNow = index;

fnTab();

}

}(i);

}

fnTab();

function fnTab(){

for (var i = 0; i 

aNav[i].classList.remove('ac');

}

aNav[iNow].classList.add('ac');

oCon.style.left = '-' + (iNow * oTab.offsetWidth) + 'px';

}

这样行吗?不太清楚你表达的意思

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值