1、div代码
<div class="nav">
<div class="on"></div>
<ul>
<li>首页</li>
<li>技巧</li>
<li>方法</li>
<li>扩展</li>
</ul>
</div>
2、css代码
* {
margin:0;
padding:0;
}
body {
background-color:#b6b3b3;
}
li {
list-style:none;
}
.nav {
width:440px;
height:60px;
margin:100px auto;
border-radius:70px;
position:relative;
}
.nav ul {
display:flex;
align-items:center;
}
.nav ul li {
width:100px;
height:50px;
line-height:50px;
box-sizing:border-box;
border-radius:10px;
text-align:center;
color:#333;
cursor:pointer;
margin: 0 5px
}
.nav .on{
width:100px;
height:50px;
border-radius:10px;
background:#f00;
position:absolute;
left:35px;
top:0;
z-index:-1;
transition:all .3s;
margin: 0 5px;
}
3、js代码
$(function() {
var left = 0;
$('.nav ul li').click(function() {
left = this.offsetLeft;
$('.nav .on').css({
left: left - 10 + 'px',
})
})
})
span点击事件后实现点击事件禁用(类似按钮disabeld方法)
上面是“juery+css菜单滑动效果”的全面内容,想了解更多关于 js 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_2166.html
workflows工作流
一张科幻照片,火星车在沙漠里ComfyUI工作流
一张精心制作的熊岛复古地图ComfyUI工作流
一朵染血的白玫瑰ComfyUI工作流
一棵树从鸟笼里长出来的梦幻般场景
一只巨大的极其精细的鞋子ComfyUI工作流
一只在星系中漂浮宇宙生物ComfyUI工作流
森林里坐着一个外星人ComfyUI工作流
迷人的月光,发光的花朵
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

3D彩色卡片
canvas黑洞漩涡(canvas+js)
barcode条形码/qrcode二维码兼容所有浏览器(含ie6/ie7/ie8)
3d文字动画效果
3d空间行走效果
制作一个好玩的倒计时
利用js+css3做一个小鱼游泳特效
Bootstrap可视化拖放布局














