返回 动画,下滑跟随...... 登陆

动画,下滑跟随-jquery实例

邈看银河系 2019-06-25 23:21:46 226

<!DOCTYPE html>

<html>

<head charset='utf-8'>

<title>下滑跟随导航</title>

<script type="text/javascript" src="css/jquery-3.4.1.min.js"></script>

<style type="text/css">

*{padding: 0;margin: 0;}

ul{list-style: none;z-index: 20;position: relative;font-size: 15px;}

li{float: left;cursor: pointer;width: 100px;height: 30px;text-align: center;line-height: 30px;color: #fff;font-weight: bold;}

.menu{width: 1080px;position: relative;margin: 20px auto;height: 32px;box-shadow: 2 2px #000;background: #AF3434;border-radius: 3px;}



</style>

<script type="text/javascript">

$(function () {

$('li').hover(function(){

$x=parseInt($(this).attr('name'))*100

$('.block').stop().animate({left:$x+'px'},300)},

function(){

$('.block').stop().animate({left:'0px'},300)

}




)

})

</script>


</head>

<body>

<div class="menu">

<ul>

<li name="0">首页</li>

<li name="1">php中文网</li>

<li name="2">独孤九剑</li>

<li name="3">西门大官人</li>

<li name="4">灭绝师太</li>

<li name="5">html视频</li>

<li name="6">php视频</li>

</ul>


    <div class="block" style="z-index: 10;width: 100px;height: 2px;background:#fff;position: absolute;top: 30px;"></div>

    </div>

</body>

</html>


最新手记推荐

• 用composer安装thinkphp框架的步骤 • 省市区接口说明 • 用thinkphp,后台新增栏目 • 管理员添加编辑删除 • 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消 回复 发送
  • PHP中文网