分享好友 教程首页 教程搜索 频道列表

jQuery网页顶部下拉分类导航菜单代码

2021-12-23 23:333490
+关注2
核心提示:效果如下jQuery制作课程网站下拉分类导航,页面滚动固定顶部导航菜单代码。使用方...

效果如下


jQuery制作课程网站下拉分类导航,页面滚动固定顶部导航菜单代码。


使用方法

1、head引入css文件

<link rel="stylesheet" href="style.css" />


2、head引入js文件

<script src="jquery-1.11.0.js" type="text/javascript" charset="utf-8"></script>


3、body引入HTML代码

<div id="wrapper">
 
    <div id="nav-header">
        <div class="header">
            <h1>
                <a href="javascript:;" class="logo">
                    <img src="logo.png" width="100"/>
                </a>
            </h1>
            <nav style="width:490px;">
                <ul>
                    <li>
                        <a href="javascript:;" class="home">首页</a>
                    </li>
                    <li class="careerpath">
                        <a href="javascript:;">职业</a><i class="slide-icon"></i>
                        <div class="zhiye-submenu slide-submeu">
                            <strong>前端</strong>
                            <a href="javascript:;"><i class="web-icon"></i>Web前端工程师</a>
                            <a href="javascript:;"><i class="wx-icon"></i>微信小程序</a>
                            <strong>移动端</strong>
                            <a href="javascript:;"><i class="android-icon"></i>Android工程师</a>
                            <a href="javascript:;"><i class="ios-icon"></i>iOS工程师</a>
                            <strong>后端</strong>
                            <a href="javascript:;"><i class="python-icon"></i>Python工程师</a>
                            <a href="javascript:;"><i class="php-icon"></i>PHP工程师</a>
                            <a href="javascript:;"><i class="golang-icon"></i>Golang工程师</a>
                            <strong>大数据</strong>
                            <a href="javascript:;"><i class="data-icon"></i>大数据平台研发工程师</a>
                            <strong>人工智能</strong>
                            <a href="javascript:;"><i class="mlearning-icon"></i>机器学习工程师</a>
                            <strong>区块链</strong>
                            <a href="javascript:;"><i class="yw-icon"></i>区块链工程师</a>
                        </div>
                    </li>
                    <li>
                        <a href="javascript:;">课程</a><i class="slide-icon"></i>
                        <div class="slide-submeu">
                            <a href="javascript:;">课程库</a>
                            <a href="javascript:;">职业路径</a>
                            <a href="javascript:;">知识体系图</a>
                            <a href="javascript:;">系列课程</a>
                        </div>
                    </li>
                    <li>
                        <a href="javascript:;">企业</a><i class="slide-icon"></i>
                        <div class="slide-submeu qy-box">
                            <a href="javascript:;"><i class="wr-icon"></i>微软人工智能 </a>
                            <a href="javascript:;"><i class="baidu-icon"></i>百度AI图像技术课</a>
                            <a href="javascript:;"><i class="aws-icon"></i>AWS云计算</a>
                            <a href="javascript:;"><i class="txy-icon"></i>腾讯云课程专区</a>
                            <a href="javascript:;"><i class="gt-icon"></i>Qualcomm公开课 </a>
                        </div>
                    </li>
                    <li>
                        <a href="javascript:;">社区</a><i class="slide-icon"></i>
                        <div class="slide-submeu">
                            <a href="javascript:;">Wiki</a>
                            <a href="javascript:;">技术问答</a>
                            <a href="javascript:;">社群</a>
                            <a href="javascript:;">资料下载</a>
                        </div>
 
                    </li>
                </ul>
            </nav>
            <div class="search">
                <input class="searchinput" id="searchinput" placeholder="搜索课程、问答或Wiki" />
                <span class="search-icon" id="search-bottom"></span>
                <div class="search-result">
                </div>
            </div>
            <div class="nav-other" id="nav-other">
                <span class="userinfo-notlogin">
               <a href="javascript:;">登录</a><i></i><a href="javascript:;">注册</a>
               </span>
            </div>
        </div>
    </div>
     
    <div style="height: 1800px;width: 100%;">
        <!--高度填充可以删除-->
    </div>
     
</div>
 
<script>
    //导航滚动置顶
    $(function(){
        var navHeight = $('#nav-header').height();
        $(document).scroll(function(){
            $(window).scrollTop()>=navHeight?$('#nav-header').addClass('fixed'):$('#nav-header').removeClass('fixed');
        })
    })
</script>


最后来个懒人模式,可上面下载附件

本文标签: #导航 #下拉
整理员:网络转载
免责声明:凡注明来源本网的所有作品,均为本网合法拥有版权或有权使用的作品,欢迎转载,注明出处。非本网作品均来自互联网,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责。
生成海报
您可能在找更多

用swiper做手机端滑动导航栏

    用代码测试

网络转载 JavaScript教程2022-05-25

js实现当前导航菜单高亮显示

    用代码测试

小黑 JavaScript教程2022-05-07

PHP版腾讯地图通过详细地址获取经纬度

    点击详情看代码

网络 PHP2022-01-07

jQuery仿某开发平台导航下拉分类菜单代码

    jQuery仿某开发平台导航下拉分类菜单代码效果如下:

网络转载 HTML相关2021-12-23

下一篇
我来说两句
抢沙发