js實(shí)現(xiàn)目錄定位正文示例
一:先查看截圖效果
1)
2)點(diǎn)擊左側(cè)導(dǎo)航欄里的目錄會(huì)對(duì)應(yīng)到對(duì)應(yīng)的層
二:下載引進(jìn)jquery-1.7.2.min.js文件
三:頁(yè)面代碼:
[code]
<pre name="code" class="html"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery縱向定位滾屏特效代碼</title>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
</head>
<body>
<style type="text/css">
.sty1{width:500px;height:500px;OVERFLOW-Y: auto; OVERFLOW-X:hidden;}/*設(shè)置層的垂直滾動(dòng)條*/
*{margin:0;padding:0;list-style:none;}
body{color:#333;font:14px/150% "Microsoft YaHei", Arial,"宋體",sans-serif;text-align:center;background:#DCDCDC;}
img{border:0;}
a{text-decoration:none;color:#333;}
html{ _background-image:url(about:blank);_background-attachment:fixed;}
/* html加上這段代碼用于取消ie6滾動(dòng)時(shí)候元素震動(dòng)bug */
/* content */
#content{position:relative;z-index:0;padding-left:250px;width:860px;}
.article{background:#04caca;text-align:left;}
.article dt{width:60%;padding-top:50px;margin:0 auto;font:normal 40px/200% "Microsoft YaHei";color:#fff;text-shadow:1px 1px 1px #666;}
.article dd{position:relative;z-index:1;width:60%;margin:20px auto 0 auto;}
.article dd .con{position:relative;z-index:1;padding:30px;font:normal 16px/200% "Microsoft YaHei";}
.article dd .con p{text-indent:24px;margin-bottom:20px;}
.con{width:500px;OVERFLOW-Y: auto; OVERFLOW-X:hidden;}
.hside{position:fixed;z-index:1;left:50px;top:5px;width:180px;height:40px;line-height:40px;background:#f50;color:#fff;font-family:仿宋;font-size:15px;}
.sideGuide{position:fixed;z-index:1;left:50px;top:45px;width:180px;background:#fff;height:90%;OVERFLOW-Y: auto; OVERFLOW-X:hidden;}
.sideGuide h3{height:40px;line-height:40px;background:#f50;font-weight:bold;color:#fff;}
.sideGuide ul{padding:10px 0;}
.sideGuide li{height:32px;line-height:32px;position:relative;font-weight:bold;border-bottom:1px solid #f4f4f4;vertical-align:middle;font-family:仿宋;font-size:15px;}
.sideGuide li s{display:none;position:absolute;top:0;left:-10px;width:10px;background:#555;height:32px;}
.sideGuide li a{display:block;color:#999;}
.sideGuide li a:hover{text-decoration:none;color:#f50;}
.sideGuide li.on s{display:block;}
.sideGuide li.on a{background:#f4f4f4;color:#333;}
</style>
<div id="content">
<div class="con" style="background:blue;" id="box0">
<h3>作者聲明
</h3>
<p>jquery縱向定位滾屏特效代碼,是個(gè)人業(yè)余興趣愛(ài)好寫(xiě)的,是基于jquery一個(gè)特效,沒(méi)有任何封裝,只是提供一種思考方式和實(shí)現(xiàn)方法,代碼共享可隨便使用,可能存在bug,但本人不承擔(dān)任何修復(fù)bug的責(zé)任。</p>
相關(guān)文章
使用ionic在首頁(yè)新聞中應(yīng)用到的跑馬燈效果的實(shí)現(xiàn)方法
在app中經(jīng)常會(huì)有滾動(dòng)的跑馬燈效果的運(yùn)用,接下來(lái)通過(guò)本文給大家介紹使用ionic在首頁(yè)新聞中應(yīng)用到的跑馬燈效果的實(shí)現(xiàn)方法,需要的的朋友參考下2017-02-02微信小程序?qū)崿F(xiàn)天氣預(yù)報(bào)功能
這篇文章主要為大家詳細(xì)介紹了微信小程序?qū)崿F(xiàn)天氣預(yù)報(bào)功能,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-07-07js removeChild 障眼法 可能出現(xiàn)的錯(cuò)誤
js removeChild 障眼法之可能出現(xiàn)的錯(cuò)誤,大家看下代碼就知道了。2009-10-10document.all與getElementById、getElementsByName、getElementsByT
Document.all[]是文檔中所有標(biāo)簽組成的一個(gè)數(shù)組變量,包括了文檔對(duì)象中所有元素2008-12-12