<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<link rel="stylesheet" href="baidu.css">
<style>
* {
margin: 0;
padding: 0
} .wrap {
width: 1000px;
overflow: hidden;
margin: 0 auto;
} .content {
width: 780px;
float: left;
} .slide {
width: 200px;
float: right;
}
</style>
</head>
<body>
<div class="wrap">
<div class="content">
<h2 class="headline-1">
<a class="anchor-1" name="1"></a>
<span class="headline-1-index">1</span>
<span class="headline-content">part1</span>
</h2> <div class="para">
content1,content1
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
<h2 class="headline-1">
<a class="anchor-1" name="2"></a>
<span class="headline-2-index">2</span>
<span class="headline-content">part2</span>
</h2> <div class="para">
content2,content2
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
<h2 class="headline-1">
<a class="anchor-1" name="2-1"></a>
<span class="headline-2-index">2-1</span>
<span class="headline-content">part2-1</span>
</h2> <div class="para">
content2-1,content2-1
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
<h2 class="headline-1">
<a class="anchor-1" name="2-2"></a>
<span class="headline-1-index">2-2</span>
<span class="headline-content">part2-2</span>
</h2> <div class="para">
content2-2,content2-2
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
<h2 class="headline-1">
<a class="anchor-1" name="3"></a>
<span class="headline-1-index">3</span>
<span class="headline-content">part3</span>
</h2> <div class="para3">
content,content
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
<h2 class="headline-1">
<a class="anchor-1" name="4"></a>
<span class="headline-1-index">4</span>
<span class="headline-content">part4</span>
</h2> <div class="para4">
content,content
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
<h2 class="headline-1">
<a class="anchor-1" name="5"></a>
<span class="headline-1-index">5</span>
<span class="headline-content">part5</span>
</h2> <div class="para">
content5,content5
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
<h2 class="headline-1">
<a class="anchor-1" name="6"></a>
<span class="headline-1-index">6</span>
<span class="headline-content">part6</span>
</h2> <div class="para">
content6,content6
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
<h2 class="headline-1">
<a class="anchor-1" name="7"></a>
<span class="headline-1-index">7</span>
<span class="headline-content">part7</span>
</h2> <div class="para">
content7,content7
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
<h2 class="headline-1">
<a class="anchor-1" name="8"></a>
<span class="headline-1-index">8</span>
<span class="headline-content">part8</span>
</h2> <div class="para">
content8,content8
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
<h2 class="headline-1">
<a class="anchor-1" name="9"></a>
<span class="headline-1-index">9</span>
<span class="headline-content">part9</span>
</h2> <div class="para">
content9,content9
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
<h2 class="headline-1">
<a class="anchor-1" name="10"></a>
<span class="headline-1-index">10</span>
<span class="headline-content">part10</span>
</h2> <div class="para">
content10,content10
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
<h2 class="headline-1">
<a class="anchor-1" name="11"></a>
<span class="headline-1-index">11</span>
<span class="headline-content">part11</span>
</h2> <div class="para">
content11,content11
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
<h2 class="headline-1">
<a class="anchor-1" name="12"></a>
<span class="headline-1-index">12</span>
<span class="headline-content">part12</span>
</h2> <div class="para">
content12,content12
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
<h2 class="headline-1">
<a class="anchor-1" name="13"></a>
<span class="headline-1-index">13</span>
<span class="headline-content">part13</span>
</h2> <div class="para">
content13,content13
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
<h2 class="headline-1">
<a class="anchor-1" name="14"></a>
<span class="headline-1-index">14</span>
<span class="headline-content">part14</span>
</h2> <div class="para">
content14,content14
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
<h2 class="headline-1">
<a class="anchor-1" name="15"></a>
<span class="headline-1-index">15</span>
<span class="headline-content">part15</span>
</h2> <div class="para">
content15,content15
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
bottom
</div>
</div>
<div class="slide">
<div id="sideToolbar" style="display: block; position: fixed;">
<div id="sideCatalog" class="sideCatalogBg" style="visibility: visible;">
<div id="sideCatalog-sidebar">
<div class="sideCatalog-sidebar-top"></div>
<div class="sideCatalog-sidebar-bottom"></div>
</div>
<div id="sideCatalog-updown" style="visibility: visible;">
<div id="sideCatalog-up" class="sideCatalog-up-disable" title="向上翻页"></div>
<div id="sideCatalog-down" class="sideCatalog-down-enable" title="向下翻页"></div>
</div>
<div id="sideCatalog-catalog">
<dl style="width:175px;zoom:1">
<dd id="sideToolbar-item-0-1" class="sideCatalog-item2 heightlight">
<span class="sideCatalog-index1">1</span>
<a class="nslog:1026" onclick="return false;" title="part1" href="#1">part1</a>
<span class="sideCatalog-dot"></span>
</dd>
<dd id="sideToolbar-item-0-2" class="sideCatalog-item1">
<span class="sideCatalog-index1">2</span>
<a class="nslog:1026" onclick="return false;" title="part2" href="#2">part2</a>
<span class="sideCatalog-dot"></span>
</dd>
<dd id="sideToolbar-item-0-2-1" class="sideCatalog-item2">
<span class="sideCatalog-index1">2-1</span>
<a class="nslog:1026" onclick="return false;" title="part2" href="#2-1">part2-1</a>
<span class="sideCatalog-dot"></span>
</dd>
<dd id="sideToolbar-item-0-2-2" class="sideCatalog-item2">
<span class="sideCatalog-index1">2-2</span>
<a class="nslog:1026" onclick="return false;" title="part2" href="#2-2">part2-2</a>
<span class="sideCatalog-dot"></span>
</dd>
<dd id="sideToolbar-item-0-3" class="sideCatalog-item1">
<span class="sideCatalog-index1">3</span>
<a class="nslog:1026" onclick="return false;" title="part3" href="#3">part3</a>
<span class="sideCatalog-dot"></span>
</dd>
<dd id="sideToolbar-item-0-4" class="sideCatalog-item1">
<span class="sideCatalog-index1">4</span>
<a class="nslog:1026" onclick="return false;" title="part4" href="#4">part4</a>
<span class="sideCatalog-dot"></span>
</dd>
<dd id="sideToolbar-item-0-5" class="sideCatalog-item1">
<span class="sideCatalog-index1">5</span>
<a class="nslog:1026" onclick="return false;" title="part5" href="#5">part5</a>
<span class="sideCatalog-dot"></span>
</dd>
<dd id="sideToolbar-item-0-6" class="sideCatalog-item1">
<span class="sideCatalog-index1">6</span>
<a class="nslog:1026" onclick="return false;" title="part6" href="#6">part6</a>
<span class="sideCatalog-dot"></span>
</dd>
<dd id="sideToolbar-item-0-7" class="sideCatalog-item1">
<span class="sideCatalog-index1">7</span>
<a class="nslog:1026" onclick="return false;" title="part7" href="#7">part7</a>
<span class="sideCatalog-dot"></span>
</dd>
<dd id="sideToolbar-item-0-8" class="sideCatalog-item1">
<span class="sideCatalog-index1">8</span>
<a class="nslog:1026" onclick="return false;" title="part8" href="#8">part8</a>
<span class="sideCatalog-dot"></span>
</dd>
<dd id="sideToolbar-item-0-9" class="sideCatalog-item1">
<span class="sideCatalog-index1">9</span>
<a class="nslog:1026" onclick="return false;" title="part9" href="#9">part9</a>
<span class="sideCatalog-dot"></span>
</dd>
<dd id="sideToolbar-item-0-10" class="sideCatalog-item1">
<span class="sideCatalog-index1">10</span>
<a class="nslog:1026" onclick="return false;" title="part10" href="#10">part10</a>
<span class="sideCatalog-dot"></span>
</dd>
<dd id="sideToolbar-item-0-11" class="sideCatalog-item1">
<span class="sideCatalog-index1">11</span>
<a class="nslog:1026" onclick="return false;" title="part11" href="#11">part11</a>
<span class="sideCatalog-dot"></span>
</dd>
<dd id="sideToolbar-item-0-12" class="sideCatalog-item1">
<span class="sideCatalog-index1">12</span>
<a class="nslog:1026" onclick="return false;" title="part12" href="#12">part12</a>
<span class="sideCatalog-dot"></span>
</dd>
<dd id="sideToolbar-item-0-13" class="sideCatalog-item1">
<span class="sideCatalog-index1">13</span>
<a class="nslog:1026" onclick="return false;" title="part13" href="#13">part13</a>
<span class="sideCatalog-dot"></span>
</dd>
<dd id="sideToolbar-item-0-14" class="sideCatalog-item1">
<span class="sideCatalog-index1">14</span>
<a class="nslog:1026" onclick="return false;" title="part14" href="#14">part14</a>
<span class="sideCatalog-dot"></span>
</dd>
<dd id="sideToolbar-item-0-15" class="sideCatalog-item1">
<span class="sideCatalog-index1">15</span>
<a class="nslog:1026" onclick="return false;" title="part15" href="#15">part15</a>
<span class="sideCatalog-dot"></span>
</dd>
</dl>
</div>
</div>
<a id="sideCatalogBtn" class="" style="visibility: visible;" href="javascript:void(0);"></a>
<a id="sideToolbar-up" style="visibility: visible;" title="返回顶部" href="javascript:void(0)"></a>
</div>
</div>
</div>
<script type="text/javascript" src="../8--11/9/9.3/重庆平台教师端20130826/tool/html/resouceshare1/js/jquery-1.8.2.min.js"></script>
<script>
var slideInnerHeight = $('#sideCatalog-catalog dl').height();
var slideOutHeight = $('#sideCatalog-catalog').height();
var enableTop = slideInnerHeight - slideOutHeight;
var step = 50;
//点击向上的按钮
$('#sideCatalog-down').bind('click', function () {
if ($(this).hasClass('sideCatalog-down-enable')) {
if ((enableTop - Math.abs(parseInt($('#sideCatalog-catalog dl').css('top')))) > step) {
$('#sideCatalog-catalog dl').stop().animate({'top': '-=' + step}, 'fast');
$('#sideCatalog-up').removeClass('sideCatalog-up-disable').addClass('sideCatalog-up-enable');
} else {
$('#sideCatalog-catalog dl').stop().animate({'top': -enableTop}, 'fast');
$(this).removeClass('sideCatalog-down-enable').addClass('sideCatalog-down-disable');
}
} else {
return false;
}
})
//点击向下的按钮
$('#sideCatalog-up').bind('click', function () {
if ($(this).hasClass('sideCatalog-up-enable')) {
if (Math.abs(parseInt($('#sideCatalog-catalog dl').css('top'))) > step) {
$('#sideCatalog-catalog dl').stop().animate({'top': '+=' + step}, 'fast');
$('#sideCatalog-down').removeClass('sideCatalog-down-disable').addClass('sideCatalog-down-enable');
} else {
$('#sideCatalog-catalog dl').stop().animate({'top': '0'}, 'fast');
$(this).removeClass('sideCatalog-up-enable').addClass('sideCatalog-up-disable');
}
} else {
return false;
}
}) //点击导航中的各个目录
$('#sideCatalog-catalog dl').delegate('dd', 'click', function (e) {
var index = $(this).index();
scrollSlide($(this), index);
var ddId = $(this).find('a').stop().attr('href').substring(1);
var windowTop = $('a[name="' + ddId + '"]').offset().top;
$('body,html').animate({scrollTop: windowTop}, 'fast');
$(this).addClass('heightlight').siblings('dd').removeClass('heightlight');
}) //滚动页面,即滚动条滚动
$(document).scroll(function () {
var len = $('.headline-1').length;
for (var i=len-1; i>=0; i--) {
if ($(this).scrollTop() >= $('.headline-1').eq(i).offset().top - $('.headline-1').eq(i).height()) {
var index = i;
$('#sideCatalog-catalog dl dd').eq(index).addClass('heightlight').siblings('dd').removeClass('heightlight');
scrollSlide($('#sideCatalog-catalog dl dd').eq(index), index);
return false;
} else {
$('#sideCatalog-catalog dl dd').eq(0).addClass('heightlight').siblings('dd').removeClass('heightlight');
}
}
}) //导航的滚动,以及向上,向下按钮的显示隐藏
function scrollSlide(that, index){
if (index < 5) {
$('#sideCatalog-catalog dl').stop().animate({'top': '0'}, 'fast');
$('#sideCatalog-down').removeClass('sideCatalog-down-disable').addClass('sideCatalog-down-enable');
$('#sideCatalog-up').removeClass('sideCatalog-up-enable').addClass('sideCatalog-up-disable');
} else if (index > 11) {
$('#sideCatalog-catalog dl').stop().animate({'top': -enableTop}, 'fast');
$('#sideCatalog-down').removeClass('sideCatalog-down-enable').addClass('sideCatalog-down-disable');
$('#sideCatalog-up').removeClass('sideCatalog-up-disable').addClass('sideCatalog-up-enable');
} else {
var dlTop = parseInt($('#sideCatalog-catalog dl').css('top')) + slideOutHeight / 2 - (that.offset().top - $(document).scrollTop());
$('#sideCatalog-catalog dl').stop().animate({'top': dlTop}, 'fast');
$('#sideCatalog-down').removeClass('sideCatalog-down-disable').addClass('sideCatalog-down-enable');
$('#sideCatalog-up').removeClass('sideCatalog-up-disable').addClass('sideCatalog-up-enable');
}
}
</script>
</body>
</html>

baidu时光轴_使用window.scroll实现的的更多相关文章

  1. 拉动滚动条追加内容,无限延伸document高度 $(window).scroll(function(){if($(window).scrollTop() + $(window).height() == $(document).height()) { $("body").append(html) } })

    $(document).ready(function() { // endless scrolling $(window).scroll(function() { if($(window).scrol ...

  2. js的onscroll、scrollTop、scrollHeight及window.scroll等方法

    onscroll 解释:当元素的滚动条滚动时触发的事件. onscroll事件貌似任何实体元素都可以绑定,这里的实体元素包括DOM元素.window元素.document元素. 用法即:element ...

  3. $(window).scroll()无法触发问题

    在微信端开发中遇到一个这种问题:明明用的公共文件(代码如下图),其他页面每次都能触发这个滚动条$(window).scroll事件,以显示右下角“回到顶部”这个按钮图标 但是,问题来了,最该需要使用“ ...

  4. window.scroll原生滚动

    window.scroll({ top: , behavior: 'smooth' }) js原生已经支持模拟滚动的效果啦~~~

  5. 置顶,置低实现与window.scroll

    //置顶,置低实现 $('#updown .up').click(function(){$('html,body').animate({scrollTop: '0px'}, 300);}); $('# ...

  6. 让$(window).scroll()监听事件只执行一次

    可以用jQuery中的unbind()来进行事件解绑. $(window).scroll(function() { console.log("滚离顶部" + $(document) ...

  7. 解决jquery animate({scrollTop$pos},500)与$(window).scroll方法冲突的问题

    当点击节点时 先移除$(window).on("scroll")监听事件 在animate动画结束之后再添加上 $('#J_tab li').on('click', functio ...

  8. 【转】window.scroll 浏览器滚动条的参数总结

    如内容超出单元格,则隐藏style="TABLE-LAYOUT: fixed" 让弹出窗口总是在最上面: <body onblur="this.focus();&q ...

  9. 时隔一年,window.scroll

    function scrollToTop() { return function(btn, input) { var flag = false; var timer; function autoScr ...

随机推荐

  1. Head First HTML5 Programming 读书笔记

    1:HTML5引入了简单化的标记,新的语义和媒体元素,另外要依赖于一组支持web应用的js库. 2:关于js 对象是属性的结合 window对象是全局变量. document对象是window的一个属 ...

  2. 怎样获取优酷站内视频的MP4格式地址,嵌入到手机页面播放

    最近的有关项目需要使用video标签播放视频,并且视频的路径src是优酷里面的视频,所以需要得到优酷里面的mp4路径才能播放. 但是在网上查了下资料,看到优酷的播放格式是一个m3u8文件,如图所示: ...

  3. Cg关键字(keywords)

    保留标识符 除了下面列出的,任何以两个的下划线作为前缀(例如,__ newType)的标识符被保留. 注意,矩阵(matrix)和向量类型(vector types)(如half2x3或float4) ...

  4. uGUI VS NGUI

    前言 这篇日志的比较是根据自己掌握知识所写的,请各路大神多多指教. 引擎版本: Unity 4.6 beta 两者区别 1.uGUI的Canvas 有世界坐标和屏幕坐标 2.uGUI的Button属性 ...

  5. java 20 - 5 字节输出流写出数据的一些方法

    首先回顾下 字节输出流操作步骤:  A:创建字节输出流对象  B:调用write()方法  C:释放资源 创建字节流输出对象 FileOutputStream fos = new FileOutput ...

  6. Android Studio系列教程六--Gradle多渠道打包

    Android Studio系列教程六--Gradle多渠道打包 2015 年 01 月 15 日 DevTools 本文为个人原创,欢迎转载,但请务必在明显位置注明出处!http://stormzh ...

  7. 一篇搞定RSA加密与SHA签名|与Java完全同步

    基础知识 什么是RSA?答:RSA是一种非对称加密算法,常用来对传输数据进行加密,配合上数字摘要算法,也可以进行文字签名. RSA加密中padding?答:padding即填充方式,由于RSA加密算法 ...

  8. 解决服务器连接错误Host ‘XXX’ is not allowed to connect to this MySQL server

    这段时间在研究火车头的入库教程,在“配置登陆信息和数据库(mysql)”连接中,出现“服务器连接错误Host 'XXX' is not allowed to connect to this MySQL ...

  9. ROWNUMBER() OVER( PARTITION BY COL1 ORDER BY COL2)用法

    今天在使用多字段去重时,由于某些字段有多种可能性,只需根据部分字段进行去重,在网上看到了rownumber() over(partition by col1 order by col2)去重的方法,很 ...

  10. js实现网页防止被iframe框架嵌套及几种location.href的区别

    首先我们了解一下几种location.href的区别简单的说:几种location.href的区别js实现网页被iframe框架功能,感兴趣的朋友可以了解下 首先我们了解一下:window.locat ...