基于jQuery实现页面定位导航滚动切换代码



如需定制开发(网站开发、二次开发)在线咨询,请点击>> QQ:753511799

135 539 180



特效描述:基于jQuery实现 页面定位导航 滚动切换。基于jQuery实现页面定位导航滚动切换代码

代码结构

1. 引入CSS

<link href="css/zzsc.css" rel="stylesheet" media="all">

2. 引入JS

<script src="js/jquery.min.js"></script>
<script src="js/jquery.nav.js"></script>

3. HTML代码

<ul id="nav">
  <li class="current"><a href="#examples">examples</a></li>
  <li><a href="#section-1">Section 1</a></li>
  <li><a href="#section-2">Section 2</a></li>
  <li><a href="#section-3">Section 3</a></li>
</ul>
<div id="container">
  <div class="section-wrapper" id="examples">
    <div class="section">
      <h2>Examples</h2>
      <p><a href="index2.html">垂直位置导航</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="index.html">水平位置导航</a></p>
    </div>
  </div>
  <div class="section-wrapper" id="section-1">
    <div class="section">
      <h1>Horizontal Nav</h1>
      <p>To account for the offset of the horizontal nav, add top negative margin and top padding. For example, the navigation on this page is 50px tall. So to each section, add a -50px top margin and 50px to offset the height of the nav. That means when you go to each section, it will scroll to the exact top of the section while accounting for the height of the nav.</p>
    </div>
  </div>
  <div class="section-wrapper" id="section-2">
    <div class="section">
      <h2>Section 2</h2>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    </div>
  </div>
  <div class="section-wrapper" id="section-3">
    <div class="section">
      <h2>Section 3</h2>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    </div>
  </div>
</div>
<script>
$(function(){
	$('#nav').onePageNav();
});
</script>
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
</div>



用户评论
大牛,别默默的看了,快登录帮我点评一下吧!:)      登录 | 注册


热门标签: 滚动导航菜单 导航切换 二级导航菜单 滚动切换 下拉导航菜单 图片滚动 图片切换 竖直导航菜单 文字滚动 文字切换 图标导航菜单 背景切换 固定导航菜单 图片文字滚动 手风琴 侧边导航菜单 全屏滚动 选项卡自动切换 树形导航菜单 页面滚动 视频切换 网址导航菜单 列表切换 导航菜单插件 渐隐切换 文字导航菜单 全屏切换 切换按钮 缩放切换 滚动流动 滚动导航菜单 滑动导航菜单 浮动导航菜单 导航切换 右键菜单 收缩导航菜单 html5动画导航菜单 flash导航菜单 滚动切换 滑动选项卡切换 自动滚动图片轮播 选项卡切换 滑动手风琴 导航菜单导航条

×
×
51前端

注册

×
绑定手机

请绑定手机号,在继续操作

×
单次下载支付

应付金额:279

支付完成后,回到下载页面,在进行下载

官方QQ群
意见反馈
qq群

扫描上面二维码加微信群

官方QQ群

jQuery/js讨论群
群号:642649996
Css3+Html5讨论群
群号:322131262

加群请备注:从官网了解到