Imitation Baidu Encyclopedia of the page navigation, the following figure for the navigation section of the effect chart:
CSS and pictures are copied Baidu, can be downloaded from the Baidu Encyclopedia.
The specific code is as follows:
The code is as follows |
Copy Code |
<! 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= "ten" ></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= "one" ></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= "></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= "></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= "></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= "></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= "Page Up" ></div>
<div id= "Sidecatalog-down" class= "sidecatalog-down-enable" title= "Page Down" ></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=" Back to Top "href=" javascript:void (0) "></a>
</div>
</div>
</div>
<script type= "Text/javascript" src= ". /jquery-1.7.2.js "></script>
<script>
var slideinnerheight = $ (' #sideCatalog-catalog dl '). Height ();
var slideoutheight = $ (' #sideCatalog-catalog '). Height ();
var enabletop = slideinnerheight-slideoutheight;
var step = 50;
Click the Up button
$ (' #sideCatalog-down '). Bind (' click ', function () {
if ($ (this). Hasclass (' sidecatalog-down-enable ')) {
if ((Enabletop-math.abs (parseint (' #sideCatalog-catalog dl '). CSS (' top '))) {
$ (' #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;
}
})
Click the Down button
$ (' #sideCatalog-up '). Bind (' click ', function () {
if ($ (this). Hasclass (' sidecatalog-up-enable ')) {
if (parseint (' #sideCatalog-catalog dl '). CSS (' top ')) (Math.Abs) {
$ (' #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;
}
})
Click on each directory in the navigation
$ (' #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 ');
})
Scroll the page, that is, scroll bar scrolling
$ (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 '). (a) 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 ');
}
}
})
Navigation scrolling, as well as up and down buttons show hidden
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). Scro Lltop ());
$ (' #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> |
Summary: Web design or to see the major stations in line, we have no time to go to these big websites to learn their special effects applications.