滚动切换

简介: 1 DOCTYPE html> 2 3 4 滚动切换 5 6 7 body, h1, h2, h3, h4, h5, h6, blockquote, p, pre, dl, dd, menu, ol, ul, ca...
 1 <!DOCTYPE html>
 2 <html>
 3 <head>
 4     <title>滚动切换</title>
 5     <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
 6     <style type="text/css">
 7             body, h1, h2, h3, h4, h5, h6, blockquote, p, pre, dl, dd, menu, ol, ul, caption, th, td, form, fieldset, legend, input, button, textarea { margin: 0; padding: 0; }
 8             h1,h2, h3, h4, h5, h6 {font-size:100%; }
 9             menu, ol, ul { list-style: none; }
10             table { border-collapse: collapse; border-spacing: 0; }
11             fieldset, img { border: 0; }
12             address, cite, dfn, em, var { font-style: normal; }
13             code, kbd, pre, samp { font-family: 'courier new',courier,monospace; }
14             input, button, textarea, select { font-size: 100%; }
15             abbr[title] { border-bottom: 1px dotted; cursor: help; }
16             a { outline: none; text-decoration: none; }
17             body, input, button, textarea, select, option, optgroup { font: 12px/1 arial, \5b8b\4f53, sans-serif; }
18             .cfl{ *zoom: 1; }
19             .cfl:after{content: "\0020"; display: block; height: 0; clear: both; overflow: hidden; visibility: hidden;}
20             .hidden{display:none;}
21 
22             #nav{width:980px; margin: 0px auto; overflow:hidden; position: fixed;background:#fff;height:60px;}
23             #nav li{width:100px; text-align: center; float:left; }
24             #nav .on{background: #f00;}
25         </style>
26     <script type="text/javascript">
27         (function ($) {
28             $.fn.scrollDiv = function (options) {
29                 options = jQuery.extend({
30                     conts: {},
31                     main: {},
32                     step: 50,
33                     navHeight: 50,
34                     timing: 800
35                 }, options);
36 
37                 var _this = $(this);
38                 var arr = new Array();
39                 var bigArr = new Array();
40                 var iii = 0;
41                 var tmp = 0;
42 
43                 $.each(options.conts, function (k, v) {
44                     arr[k] = $(v).height();
45                     tmp += $(v).height();
46                     bigArr[k] = parseInt(tmp - 50);
47                     console.log(arr[k] + "   " + bigArr[k] + "   ");
48                 });
49 
50                 $(window).scroll(function () {
51                     var scroll = $(this).scrollTop();
52                     for (var i in bigArr) {
53                         if (bigArr[i] > scroll) {
54                             iii = i;
55                             break;
56                         }
57                     }
58                     _this.find("li").attr("class", "").eq(iii).attr("class", "on");
59                 });
60 
61                 var navLis = _this.find("li");
62                 navLis.click(function () {
63                     var tmpi = parseInt($(this).index());
64                     $('html,body').animate({ scrollTop: (options.main.find(".bigcont").eq(tmpi).offset().top - options.navHeight) + "px" }, options.timing);
65                     return false;
66                 });
67             }
68         })(jQuery);
69     </script>
70     <script type="text/javascript">
71         $(function () {
72             $("#nav").scrollDiv({ "conts": $("#main .bigcont"), "main": $("#main") });
73         });         
74     </script>
75 </head>
76 <body>
77     <ul id="nav" class="cfl">
78         <li class="on">a </li>
79         <li>b </li>
80         <li>c </li>
81         <li>d </li>
82         <li>e </li>
83     </ul>
84     <div id="main">
85         <div class="bigcont" style="height: 600px; background: #ff0">
86         </div>
87         <div class="bigcont" style="height: 600px; background: #f0f">
88         </div>
89         <div class="bigcont" style="height: 800px; background: #0ff">
90         </div>
91         <div class="bigcont" style="height: 1000px; background: #f00">
92         </div>
93         <div class="bigcont" style="height: 600px; background: #f60">
94         </div>
95     </div>
96 </body>
97 </html>

 

目录
相关文章
|
8天前
|
域名解析 人工智能 Linux
|
18天前
|
Linux Go 开发工具
手机上跑 DeepSeek 智能体:开源安卓客户端 DSH Go 安装与使用指南
DSH Go 是一款开源安卓客户端,将 DeepSeek Harness 智能体引擎装进手机:免 Root、免 Termux,一键安装即用;支持本机运行(内置 Ubuntu+Node.js)或远程接管电脑会话;具备插话打断、过程折叠、屏幕操控、端到端加密分享等特色功能,真正实现智能体“口袋化”。
16909 62
|
16天前
|
人工智能
Google 提示「所在地区不可用」?进不去 Antigravity 或 Gemini,先查账号这个设置
进不去 Antigravity 或 Gemini,提示所在地区不可用?三步查清 Google 账号关联地区、官方更正表单理由选法与改区注意事项。
Google 提示「所在地区不可用」?进不去 Antigravity 或 Gemini,先查账号这个设置
|
2天前
|
人工智能 安全 网络安全
|
5天前
|
云安全 数据采集 人工智能
|
7天前
|
Linux API iOS开发
【DSH】DeepSeek Harness新手保姆教程(下载+安装+配置+使用,2026最新实测)
DeepSeek Harness(dsh)是 DeepSeek AI 开源的智能体框架,秉持“一切皆插件”理念,支持读文件、改代码、执行命令、处理表格等自动化任务;免费开源,兼容 Win/macOS,需配 API 密钥使用。(239字)
1243 2
|
13天前
|
人工智能 开发工具 开发者
2026最新codex下载安装保姆级使用教程(下载+安装+登录+使用,含所有历史版本)
Codex 是 OpenAI 推出的开源 AI 编程智能体,跑在本地终端和桌面客户端里,能读懂整个代码仓库,一句自然语言就能让它改代码、执行命令、跑测试、修 Bug,支持 Windows、macOS、Linux 三大平台。本文把 Codex下载、安装、登录、汉化、基础使用一次讲全,并整理了国内用户最常踩的坑,跟着做 10 分钟就能跑起来。
2333 7
|
18天前
|
弹性计算 人工智能 API
Codex超详细入门指南(下载·安装·登录·上手,全版本覆盖,2026最新版)
建议收藏本教程,2026 全年各版本更新随时回来查阅。如果你在搭建过程中遇到任何问题,欢迎结合 阿里云工单系统 提交技术支持请求,或在 阿里云开发者社区 搜索 Codex 相关话题交流。 祝你编码愉快,效率翻倍!
3800 22
|
19天前
|
Linux API iOS开发
【DSH】DeepSeek Harness新手保姆教程(下载+安装+配置+使用,2026最新实测)
DeepSeek Harness(dsh)是DeepSeek AI开源的智能体框架,秉持“一切皆插件”理念,支持读文件、改代码、跑命令、处理表格、联网搜索等操作。免费开源,兼容Windows/macOS/Linux,提供桌面端与网页端,可灵活安装插件扩展能力。