{"id":331,"date":"2012-11-23T16:57:08","date_gmt":"2012-11-23T08:57:08","guid":{"rendered":"http:\/\/www.bluesdream.com\/blog\/?p=331"},"modified":"2015-05-30T16:10:38","modified_gmt":"2015-05-30T08:10:38","slug":"build-a-jquery-parallax-scrolling-website","status":"publish","type":"post","link":"https:\/\/www.bluesdream.com\/blog\/build-a-jquery-parallax-scrolling-website.html","title":{"rendered":"jQuery Parallax Scrolling Website(\u89c6\u5dee\u6eda\u52a8\u7f51\u7ad9\u5236\u4f5c)"},"content":{"rendered":"<p>\u5520\u53e8\u4e00\u4e0b\uff1a<br \/>\n\u4e00\u76f4\u6ca1\u65f6\u95f4\u53bb\u7814\u7a76\u89c6\u5dee\u6eda\u52a8\u7684\u5185\u5bb9\uff0c\u4e4d\u770b\u4e4b\u4e0b\u8fd8\u89c9\u5f97\u633a\u96be\u3001\u86ee\u9ebb\u70e6\u7684\uff0c\u4e0d\u77e5\u9053\u4f60\u6709\u6ca1\u6709\u540c\u611f\uff1f\u6211\u5728\u5ea6\u5a18\u627e\u4e86\u534a\u5929\uff0c\u4e5f\u6ca1\u627e\u5230\u4ec0\u4e48\u6709\u7528\u7684\u8d44\u6599\uff08\u8d77\u7801\u6211\u6ca1\u627e\u5230\uff0c\u8981\u4e48\u5c31\u662f\u5199\u7684\u50cf\u5929\u4e66\u4e00\u6837\uff0c\u6ca1\u7cbe\u529b\u53bb\u6298\u817e\uff09\u8c37\u6b4c\u4e48\u81ea\u4eceX8\u5927\u4ee5\u6765\uff0c\u4e00\u76f4\u5904\u4e8e\u60b2\u5267\u72b6\u6001\u3002\u8fd9\u4e24\u5929\u6b63\u597d\u7a7a\u95f2\u4e0b\u6765\uff0c\u5c31\u53c8\u53bb\u627e\u4e86\u4e0b\u76f8\u5173\u7684\u8d44\u6599\u3002\u4e0d\u770b\u4e0d\u77e5\u9053\uff0c\u4e00\u770b\u5413\u4e00\u8df3\uff0c\u987f\u65f6\u604d\u7136\u5927\u609f\uff0c\u539f\u6765\u90a3\u4e48\u7b80\u5355\u3002\u3002\u3002<\/p>\n<p><strong>\u4ec0\u4e48\u662f\u89c6\u5dee\u6eda\u52a8\uff1f<\/strong><br \/>\n\u89c6\u5dee\u6eda\u52a8\uff08Parallax Scrolling\uff09\u89c6\u5dee\u6eda\u52a8\u662f\u4e00\u4e2a\u4e8c\u7ef4\u52a8\u753b\u5236\u4f5c\u8fc7\u7a0b\uff0c\u521b\u5efa\u4e00\u4e2a\u52a8\u753b\u524d\u666f\u5c42\u7684\u901f\u5ea6\u6bd4\u80cc\u666f\u5c42\u6df1\u5ea6\u7684\u5e7b\u89c9\u3002\u7b80\u5355\u7684\u8bf4\uff0c\u5c31\u662f\u8ba9\u591a\u4e2a\u5c42\u9762\u7684\u4e1c\u897f(\u5982\u679c\u4f60\u6709\u63a5\u89e6\u8fc7PS\u6216FLASH\uff0c\u5e94\u8be5\u5f88\u5bb9\u6613\u7406\u89e3\"\u5c42\"\u8fd9\u4e2a\u6982\u5ff5)\uff0c\u4ee5\u4e0d\u540c\u7684\u901f\u5ea6\u79fb\u52a8\uff0c\u5f62\u6210\u7acb\u4f53\u7684\u8fd0\u52a8\u6548\u679c\u3002\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u5f53\u4f60\u5750\u5728\u884c\u9a76\u4e2d\u7684\u6c7d\u8f66\u5185\uff0c\u770b\u7740\u7a97\u5916\u8fd1\u666f\u7684\u6811\u6728\uff0c\u518d\u770b\u8fdc\u5904\u7684\u5c71\u6216\u4e8b\u7269\uff0c\u4f60\u4f1a\u53d1\u89c9\u6811\u79fb\u52a8\u7684\u5f88\u5feb\uff0c\u800c\u8fdc\u5904\u7684\u4e8b\u7269\u5374\u79fb\u52a8\u7684\u5f88\u6162\u3002\u89c6\u5dee\u6eda\u52a8\u4f7f\u7528\u76f8\u540c\u7684\u539f\u5219\u6765\u8bef\u5bfc\u4eba\u4eec\u773c\u775b\uff0c\u4ee5\u4e3a\u4ed6\u4eec\u6240\u89c2\u5bdf\u5230\u76843D\u573a\u666f\u3002\u5177\u4f53\u63cf\u8ff0\uff0c\u53ef\u4ee5\u67e5\u770b\u7ef4\u57fa\u767e\u79d1 <a href=\"http:\/\/en.wikipedia.org\/wiki\/Parallax_scrolling\" target=\"_blank\">Parallax scrolling<\/a><!--more--><\/p>\n<p><strong>\u5982\u4f55\u5236\u4f5c\uff1f<\/strong><br \/>\n\u672c\u4eba\u4e0d\u63d0\u5021\u201c\u62ff\u6765\u4e3b\u4e49\u201d\u968f\u4fbf\u5c31\u628a\u4ee3\u7801\u8d34\u5230\u81ea\u5df1\u7684\u9875\u9762\u4e2d\uff0c\u6216\u662f\u76f4\u63a5\u4e0b\u8f7d\u6e90\u7801\u62ff\u6765\u7528\u3002\u5982\u679c\u4f60\u662f\u60f3\u5b66\u4e60\uff0c\u90a3\u5efa\u8bae\u4f60\u8ddf\u7740\u6b65\u9aa4\u5199\u4e00\u904d\u3002\u53cd\u4e4b\uff0c\u4f60\u5c31\u968f\u610f\u5427\u3002\u63a5\u4e0b\u6765\u8bf7\u4ee5\u770b\u4ee3\u7801\uff1a<\/p>\n<p><strong>HTML CODE:<\/strong><\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;div id=&quot;wrapper&quot;&gt;\r\n\t&lt;header id=&quot;header&quot;&gt;\r\n\t\t&lt;h1&gt;jQuery\u89c6\u5dee\u6eda\u52a8\u793a\u4f8b - \u4e16\u754c\u822a\u7a7a\u822a\u5929\u53f2&lt;\/h1&gt;\r\n\t&lt;\/header&gt;\r\n\t&lt;!-- \u5185\u5bb9\u5c42 --&gt;\r\n\t&lt;div id=&quot;content&quot;&gt;\r\n\t\t&lt;article id=&quot;article1&quot;&gt;\r\n\t\t\t&lt;section class=&quot;section&quot;&gt;\r\n\t\t\t\t&lt;h2&gt;\u7b2c\u4e00\u6b21\u8f7d\u4eba\u98de\u884c&lt;\/h2&gt;\r\n\t\t\t\t&lt;p&gt;1783\u5e7411\u670821\u65e5\uff0c\u5b5f\u6208\u83f2\u5144\u5f1f(\u7ea6\u745f\u592b\u2014\u7c73\u6b47\u5c14\u00b7\u5b5f\u6208\u83f2 Joseph-Michel Montgolfier \u548c \u96c5\u514b\u2014\u827e\u8482\u5b89\u00b7\u5b5f\u6208\u83f2  Jacques-\u00c9tienne Montgolfier)\u7528\u70ed\u6c14\u7403\u8fdb\u884c\u4e86\u7b2c\u4e00\u6b21\u8f7d\u4eba\u98de\u884c\u5b9e\u9a8c\u3002\u6c14\u7403\u4ece\u5df4\u9ece\u897f\u90e8\u7684\u5e03\u6d1b\u6d85\u6797\u56ed\u8d77\u98de\uff0c\u5728\u7a7a\u4e2d\u6301\u7eed\u4e8625\u5206\u949f\uff0c\u6700\u540e\u964d\u843d\u5728\u4eca\u5df4\u9ece\u5341\u4e09\u533a\u7684\u610f\u5927\u5229\u5e7f\u573a\u9644\u8fd1\u3002&lt;\/p&gt;\r\n\t\t\t&lt;\/section&gt;\r\n\t\t\t&lt;footer class=&quot;next_prev&quot;&gt;&lt;i class=&quot;spacing_line&quot;&gt;&lt;\/i&gt;&lt;a class=&quot;next article2&quot; href=&quot;#&quot;&gt;Next&lt;\/a&gt;&lt;\/footer&gt;\r\n\t\t&lt;\/article&gt;\r\n\t\t&lt;article id=&quot;article2&quot;&gt;\r\n\t\t\t&lt;section class=&quot;section&quot;&gt;\r\n\t\t\t\t&lt;h2&gt;\u65e0\u9aa8\u964d\u843d\u4f1e&lt;\/h2&gt;\r\n\t\t\t\t&lt;p&gt;1797\u5e74\u5b89\u5fb7\u70c8-\u96c5\u514b\u00b7\u52a0\u7eb3\u6797(Andr\u00e9-Jacques Garnerin)\u5728\u5df4\u9ece\u8499\u68ad\u516c\u56ed\u516c\u5f00\u8868\u6f14\uff0c\u4ed6\u4ece1000\u7c73\u7a7a\u4e2d\u8dc3\u4e0b\uff0c\u5e76\u9760\u4e1d\u8d28\u964d\u843d\u4f1e\u6210\u529f\u7740\u9646\u3002\u4e4b\u540e\u4ed6\u5f00\u59cb\u5728\u5317\u6b27\u8fdb\u884c\u5de1\u6f14\uff0c\u5e76\u4e8e1802\u5e74\u5728\u4f26\u6566\u4ece\u60ca\u4eba\u76842400\u7c73\u7684\u9ad8\u5ea6\u8dc3\u4e0b\u3002&lt;\/p&gt;\r\n\t\t\t&lt;\/section&gt;\r\n\t\t\t&lt;footer class=&quot;next_prev&quot;&gt;&lt;a class=&quot;prev article1&quot; href=&quot;&quot;&gt;top&lt;\/a&gt;&lt;i class=&quot;spacing_line&quot;&gt;&lt;\/i&gt;&lt;a class=&quot;next article3&quot; href=&quot;&quot;&gt;Next&lt;\/a&gt;&lt;\/footer&gt;\r\n\t\t&lt;\/article&gt;\r\n\t\t&lt;article id=&quot;article3&quot;&gt;\r\n\t\t\t&lt;section class=&quot;section&quot;&gt;\r\n\t\t\t\t&lt;h2&gt;\u7a7f\u8d8a\u82f1\u5409\u5229\u6d77\u5ce1&lt;\/h2&gt;\r\n\t\t\t\t&lt;p&gt;1785\u5e741\u67087\u65e5\uff0c\u6cd5\u56fd\u6c14\u7403\u98de\u884c\u5bb6\u8ba9-\u76ae\u57c3\u5c14\u00b7\u5e03\u5170\u67e5\u5fb7(Jean-Pierre Blanchard)\u548c\u7f8e\u56fd\u533b\u751f\u7ea6\u7ff0\u00b7\u6770\u5f17\u91cc\u65af(John Jeffries)\u4ece\u591a\u4f5b\u5821\u4e58\u6c22\u6c14\u7403\u51fa\u53d1\u3002\u5728\u8def\u9014\u4e2d\uff0c\u4ed6\u4eec\u4e0d\u5f97\u4e0d\u628a\u6240\u6709\u4e1c\u897f\u90fd\u6254\u51fa\u6c14\u7403\u5916\u624d\u80fd\u7ef4\u6301\u6f02\u6d6e\u72b6\u6001\u3002\u4e0d\u8fc7\u6700\u7ec8\u5728\u4e24\u4e2a\u534a\u5c0f\u65f6\u540e\uff0c\u4ed6\u4eec\u4e24\u4e2a\u8fd8\u662f\u6beb\u53d1\u65e0\u635f\u5730\u5230\u8fbe\u4e86\u6cd5\u56fd\u3002&lt;\/p&gt;\r\n\t\t\t&lt;\/section&gt;\r\n\t\t\t&lt;footer class=&quot;next_prev&quot;&gt;&lt;a class=&quot;prev article2&quot; href=&quot;&quot;&gt;top&lt;\/a&gt;&lt;i class=&quot;spacing_line&quot;&gt;&lt;\/i&gt;&lt;a class=&quot;next article4&quot; href=&quot;&quot;&gt;Next&lt;\/a&gt;&lt;\/footer&gt;\r\n\t\t&lt;\/article&gt;\r\n\t\t&lt;article id=&quot;article4&quot;&gt;\r\n\t\t\t&lt;section class=&quot;section&quot;&gt;\r\n\t\t\t\t&lt;h2&gt;\u5173\u4e8e&lt;\/h2&gt;\r\n\t\t\t\t&lt;p&gt;\u8fd9\u662f\u4e00\u4e2a\u57fa\u4e8ejQuery\u7684\u89c6\u5dee\u6eda\u52a8\u793a\u4f8b\u3002&lt;br&gt;\u8be6\u7ec6\u5185\u5bb9\uff0c&lt;a href=&quot;#&quot;&gt;\u8bf7\u67e5\u770b\u539f\u6587&lt;\/a&gt;&lt;\/p&gt;\r\n\t\t\t\t&lt;p&gt;By: www.bluesdream.com&lt;\/p&gt;\r\n\t\t\t&lt;\/section&gt;\r\n\t\t\t&lt;footer class=&quot;next_prev&quot;&gt;&lt;a class=&quot;prev article3&quot; href=&quot;&quot;&gt;top&lt;\/a&gt;&lt;i class=&quot;spacing_line&quot;&gt;&lt;\/i&gt;&lt;\/footer&gt;\r\n\t\t&lt;\/article&gt;\r\n\t&lt;\/div&gt;\r\n\t&lt;!-- \u6c14\u7403\u3001\u98ce\u666f\u56fe\u7247\u5c42 --&gt;\r\n\t&lt;div id=&quot;parallax_area1&quot;&gt;\r\n\t\t&lt;img class=&quot;parallax_img p1_1&quot; src=&quot;images\/balloon.png&quot; width=&quot;529&quot; height=&quot;757&quot; alt=&quot;Montgolfier hot air balloon&quot;&gt;\r\n\t\t&lt;img class=&quot;parallax_img p1_2&quot; src=&quot;images\/balloon2.png&quot; width=&quot;603&quot; height=&quot;583&quot; alt=&quot;Frameless parachute&quot;&gt;\r\n\t\t&lt;img class=&quot;parallax_img p1_3&quot; src=&quot;images\/balloon3.png&quot; width=&quot;446&quot; height=&quot;713&quot; alt=&quot;Blanchard's air balloon&quot;&gt;\r\n\t\t&lt;img class=&quot;parallax_img p1_4&quot; src=&quot;images\/ground.png&quot; width=&quot;1104&quot; height=&quot;684&quot; alt=&quot;Landscape with trees and cows&quot;&gt;\r\n\t&lt;\/div&gt;\r\n\t&lt;!-- \u4e91\u5c421 --&gt;\r\n\t&lt;div id=&quot;parallax_area2&quot;&gt;\r\n\t\t&lt;img class=&quot;parallax_img p2_1&quot; src=&quot;images\/cloud1.png&quot; width=&quot;488&quot; height=&quot;138&quot; alt=&quot;cloud&quot;&gt;\r\n\t\t&lt;img class=&quot;parallax_img p2_2&quot; src=&quot;images\/cloud1.png&quot; width=&quot;488&quot; height=&quot;138&quot; alt=&quot;cloud&quot;&gt;\r\n\t\t&lt;img class=&quot;parallax_img p2_3&quot; src=&quot;images\/cloud1.png&quot; width=&quot;488&quot; height=&quot;138&quot; alt=&quot;cloud&quot;&gt;\r\n\t\t&lt;img class=&quot;parallax_img p2_4&quot; src=&quot;images\/cloud1.png&quot; width=&quot;488&quot; height=&quot;138&quot; alt=&quot;cloud&quot;&gt;\r\n\t\t&lt;img class=&quot;parallax_img p2_5&quot; src=&quot;images\/cloud1.png&quot; width=&quot;488&quot; height=&quot;138&quot; alt=&quot;cloud&quot;&gt;\r\n\t&lt;\/div&gt;\r\n\t&lt;!-- \u4e91\u5c422 --&gt;\r\n\t&lt;div id=&quot;parallax_area3&quot;&gt;\r\n\t\t&lt;img class=&quot;parallax_img p3_1&quot; src=&quot;images\/cloud2.png&quot; width=&quot;311&quot; height=&quot;105&quot; alt=&quot;Montgolfier hot air balloon&quot;&gt;\r\n\t\t&lt;img class=&quot;parallax_img p3_2&quot; src=&quot;images\/cloud2.png&quot; width=&quot;311&quot; height=&quot;105&quot; alt=&quot;Frameless parachute&quot;&gt;\r\n\t\t&lt;img class=&quot;parallax_img p3_3&quot; src=&quot;images\/cloud2.png&quot; width=&quot;311&quot; height=&quot;105&quot; alt=&quot;Blanchard's air balloon&quot;&gt;\r\n\t\t&lt;img class=&quot;parallax_img p3_4&quot; src=&quot;images\/cloud2.png&quot; width=&quot;311&quot; height=&quot;105&quot; alt=&quot;Landscape with trees and cows&quot;&gt;\r\n\t&lt;\/div&gt;\r\n\r\n&lt;\/div&gt;\r\n<\/pre>\n<p><strong>CSS CODE:<\/strong><\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\n*{ margin: 0; padding: 0;}\r\nbody{ background:#E5E5E5; font-family:&quot;Microsoft YaHei&quot;,Arial,sans-serif;}\r\nul{ list-style:none;}\r\na, a:link,a:active,a:visited{ color:#21a97e; outline: none; text-decoration:none; -webkit-transition: color 0.25s ease-out; -moz-transition: color 0.25s ease-out; -o-transition: color 0.25s ease-out; transition: color 0.25s ease-out;}\r\na:hover { color:#000;}\r\n\r\n#wrapper{ height:4300px; position:relative;}\r\n#header{ background:white; padding:10px 100px;}\r\n#header h1{ width:940px; font-size:20px; color:#21A97E; margin:0 auto;}\r\n.parallax_img{ position:absolute;}\r\n\/* content *\/\r\n#content{ max-width:940px; margin:0 auto; position:relative; z-index:4;}\r\n#content h2{ color:#21A97E; font-size:60px; font-weight:normal;}\r\n#content p{ font-size:14px; line-height:20px; margin-top:20px;}\r\n#content article{ width:340px; position:absolute; padding-top:120px;}\r\n#content section{ margin-bottom:30px;}\r\n#content .spacing_line{ display:block; height:3px; margin:5px 0; border:none; border-top:1px solid #3B3B3B; border-bottom:1px solid #3B3B3B;}\r\n#content .next,#content .prev{ display:block; width:14px; height:11px; text-indent:-9999px; margin:0 auto; background:url(images\/scroll_arrow.png) no-repeat;}\r\n#content .next{ background-position:0 0;}\r\n#content .next:hover{background-position:0 -11px;}\r\n#content .prev{ background-position:0 -22px;}\r\n#content .prev:hover{ background-position:0 -33px;}\r\n#article1{ top:0;}\r\n#article2{ top:1060px;}\r\n#article3{ top:2150px;}\r\n#article4{ top:3240px;}\r\n\/* parallax_area1 *\/\r\n#parallax_area1{ position:fixed; top:0; left:50%; margin-left:-470px; z-index:3;}\r\n.p1_1{ top:-110px; left:355px;}\r\n.p1_2{ top:812px; left:321px;}\r\n.p1_3{ top:1628px; left:403px;}\r\n.p1_4{ top:2700px; left:-85px;}\r\n\/* parallax_area2 *\/\r\n#parallax_area2{ position:fixed; top:0; left:50%; margin-left:-600px; z-index:2;}\r\n.p2_1{ top:162px; left:200px;}\r\n.p2_2{ top:300px; left:1150px;}\r\n.p2_3{ top:543px; left:-35px;}\r\n.p2_4{ top:1180px; left:250px;}\r\n.p2_5{ top:900px; left:890px;}\r\n\/* parallax_area3 *\/\r\n#parallax_area3{ position:fixed; top:0; left:50%; margin-left:-600px; z-index:1;}\r\n.p3_1{ top:85px; left:-270px;}\r\n.p3_2{ top:440px; left:795px;}\r\n.p3_3{ top:900px; left:-220px;}\r\n.p3_4{ top:1020px; left:450px;}\r\n<\/pre>\n<p>\u81f3\u6b64\uff0c\u6211\u4eec\u7684\u5e03\u5c40\u5df2\u7ecf\u5168\u90e8\u5b8c\u6210\u3002\u63a5\u4e0b\u6765\u5c31\u8ba9\u6211\u4eec\u4f1f\u5927\u7684JS\u767b\u573a\u5427\uff0c\u628a\u4e0b\u9762\u7684JS\u52a0\u5165\u8fdb\u53bb\uff0c\u4e00\u4e2a\u89c6\u5dee\u6eda\u52a8\u7f51\u9875\u5c31\u5b8c\u6210\u4e86\u3002\u6eda\u52a8\u4f60\u7684\u9875\u9762\uff0c\u770b\u770b\u662f\u4e0d\u662f\u53d8\u7684\u7acb\u4f53\u4e86\uff1f(\u6ca1\u9519\uff0c\u4e0d\u8981\u6000\u7591\u81ea\u5df1\u7684\u773c\u775b\uff0c\u5c31\u662f\u90a3\u4e48\u7b80\u5355\u3002\u5b83\u5c31\u50cf\u662f\u4e2a\u5c0f\u5c0f\u7684\u969c\u773c\u6cd5\u3002)<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n$(function() {\r\n\t$(window).scroll(function(){\r\n\t\tvar scrolled = $(this).scrollTop();\r\n\t\t$('#parallax_area1').css('top',(0-(scrolled*.75))+'px');\r\n\t\t$('#parallax_area2').css('top',(0-(scrolled*.5))+'px');\r\n\t\t$('#parallax_area3').css('top',(0-(scrolled*.25))+'px');\r\n\t});\r\n});\r\n<\/pre>\n<p>\u6700\u540e\uff0c\u6211\u76f8\u4fe1\u4f60\u5e94\u8be5\u5df2\u7ecf\u770b\u51fa\u5176\u4e2d\u7684\u5965\u5999\u4e86\uff0c\u4f46\u8fd8\u6709\u4e0d\u80fd\u65e0\u6cd5\u5b9e\u73b0\uff0c\u4f8b\u5982\u5bfc\u822a\u548c\u8df3\u8f6c\u3002\u63a5\u7740\u8ba9\u6211\u4eec\u52a0\u4e0a\u5176\u4ed6\u7684\u529f\u80fd\uff0c\u5b8c\u5584\u8fd9\u4e2a\u7f51\u9875\u5427\u3002<\/p>\n<p><strong>javascript:<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n$(function() {\r\n\tredrawDotNav();\r\n\t\/* \u7ed1\u5b9a\u6eda\u52a8\u4e8b\u4ef6 *\/\r\n\t$(window).bind('scroll',function(){\r\n\t\tparallaxScroll();\r\n\t\tredrawDotNav();\r\n\t});\r\n\r\n\t\/* \u8df3\u8f6c *\/\r\n\t$('.jump_to').click(function(){\r\n\t\tvar toArticle = &quot;#article&quot;+$(this).attr(&quot;rel&quot;); \/\/rel\u7684\u503c\u662f\u81ea\u5b9a\u4e49\u7684 \u8ba9\u6211\u4eec\u77e5\u9053 \u8981\u8df3\u5230\u7b2c\u51e0\u6bb5\r\n\t\t$('html, body').animate({\r\n\t\t\tscrollTop:$(toArticle).offset().top\r\n\t\t}, 1000, function() {\r\n\t\t\tparallaxScroll();\r\n\t\t});\r\n\t\treturn false;\r\n\t});\r\n\r\n\t\/* \u56fe\u5c42\u7684\u6eda\u52a8\u8303\u56f4  \u8fd9\u4e2a\u662f\u91cd\u4e2d\u4e4b\u91cd... *\/\r\n\tfunction parallaxScroll(){ \/\/\r\n\t\tvar scrolled = $(window).scrollTop();\r\n\t\t$('#parallax_area1').css('top',(0-(scrolled*.75))+'px');\r\n\t\t$('#parallax_area2').css('top',(0-(scrolled*.5))+'px');\r\n\t\t$('#parallax_area3').css('top',(0-(scrolled*.25))+'px');\r\n\t};\r\n\r\n\t\/* \u7528\u6237\u6eda\u52a8\u65f6 \u8bbe\u7f6e\u5bfc\u822a\u70b9\u7684\u6d3b\u52a8\u72b6\u6001 *\/\r\n\tfunction redrawDotNav(){\r\n\t\tvar article1Top = 0;\r\n\t\tvar article2Top = $('#article2').offset().top - (($('#article3').offset().top - $('#article2').offset().top) \/ 2);\r\n\t\tvar article3Top = $('#article3').offset().top - (($('#article4').offset().top - $('#article3').offset().top) \/ 2);\r\n\t\tvar article4Top = $('#article4').offset().top - (($(document).height() - $('#article4').offset().top) \/ 2);;\r\n\t\t$('#primary a').removeClass('active');\r\n\t\tif($(document).scrollTop() &gt;= article1Top && $(document).scrollTop() &lt; article2Top){\r\n\t\t\t$('#primary a.n1').addClass('active');\r\n\t\t} else if ($(document).scrollTop() &gt;= article2Top && $(document).scrollTop() &lt; article3Top){\r\n\t\t\t$('#primary a.n2').addClass('active');\r\n\t\t} else if ($(document).scrollTop() &gt;= article3Top && $(document).scrollTop() &lt; article4Top){\r\n\t\t\t$('#primary a.n3').addClass('active');\r\n\t\t} else if ($(document).scrollTop() &gt;= article4Top){\r\n\t\t\t$('#primary a.n4').addClass('active');\r\n\t\t}\r\n\t};\r\n\r\n\t\/* \u9f20\u6807\u7ecf\u8fc7\u5bfc\u822a\u6309\u94ae \u663e\u793aor\u9690\u85cf\u63d0\u793a\u6587\u5b57 *\/\r\n\t$('#primary a').hover(function () {\r\n\t\t\t$(this).prev('h2').show();\r\n\t\t},function () {\r\n\t\t\t$(this).prev('h2').hide();\r\n\t\t}\r\n\t);\r\n\r\n});\r\n<\/pre>\n<p><a class=\"dlBtn\" title=\"Demo\" href=\"http:\/\/www.bluesdream.com\/case\/jquery\/jquery-parallax-scrolling\/\" target=\"_blank\">Demo<\/a>\u3000<a class=\"dlBtn\" title=\"Download\" href=\"http:\/\/www.bluesdream.com\/case\/jquery\/jquery-parallax-scrolling\/jQueryParallaxScrolling.rar\" target=\"_blank\">Download<\/a><\/p>\n<p>\u53c2\u8003\u8d44\u6599\uff1a<a href=\"http:\/\/f6design.com\/journal\/2011\/08\/06\/build-a-parallax-scrolling-website-interface-with-jquery-and-css\/\" target=\"_blank\">Build a parallax scrolling website interface with jQuery and CSS<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5520\u53e8\u4e00\u4e0b\uff1a \u4e00\u76f4\u6ca1\u65f6\u95f4\u53bb\u7814\u7a76\u89c6\u5dee\u6eda\u52a8\u7684\u5185\u5bb9\uff0c\u4e4d\u770b\u4e4b\u4e0b\u8fd8\u89c9\u5f97\u633a\u96be\u3001\u86ee\u9ebb\u70e6\u7684\uff0c\u4e0d\u77e5\u9053\u4f60\u6709\u6ca1\u6709\u540c\u611f\uff1f\u6211\u5728\u5ea6\u5a18\u627e\u4e86\u534a\u5929\uff0c\u4e5f\u6ca1\u627e\u5230\u4ec0\u4e48\u6709\u7528\u7684\u8d44\u6599\uff08\u8d77\u7801\u6211\u6ca1\u627e\u5230\uff0c\u8981\u4e48\u5c31\u662f\u5199\u7684\u50cf\u5929\u4e66\u4e00\u6837\uff0c\u6ca1\u7cbe\u529b\u53bb\u6298\u817e\uff09\u8c37\u6b4c\u4e48\u81ea\u4eceX8\u5927\u4ee5\u6765\uff0c\u4e00\u76f4\u5904\u4e8e\u60b2\u5267\u72b6\u6001\u3002\u8fd9\u4e24\u5929\u6b63\u597d\u7a7a\u95f2\u4e0b\u6765\uff0c\u5c31\u53c8\u53bb\u627e\u4e86\u4e0b\u76f8\u5173\u7684\u8d44\u6599\u3002\u4e0d\u770b\u4e0d\u77e5\u9053\uff0c\u4e00\u770b\u5413\u4e00\u8df3\uff0c\u987f\u65f6\u604d\u7136\u5927\u609f\uff0c\u539f\u6765\u90a3\u4e48\u7b80\u5355\u3002\u3002\u3002 \u4ec0\u4e48\u662f\u89c6\u5dee\u6eda\u52a8\uff1f \u89c6\u5dee\u6eda\u52a8\uff08Parallax Scrolling\uff09\u89c6\u5dee\u6eda\u52a8\u662f\u4e00\u4e2a\u4e8c\u7ef4\u52a8\u753b\u5236\u4f5c\u8fc7\u7a0b\uff0c\u521b\u5efa\u4e00\u4e2a\u52a8\u753b\u524d\u666f\u5c42\u7684\u901f\u5ea6\u6bd4\u80cc\u666f\u5c42\u6df1\u5ea6\u7684\u5e7b\u89c9\u3002\u7b80\u5355\u7684\u8bf4\uff0c\u5c31\u662f\u8ba9\u591a\u4e2a\u5c42\u9762\u7684\u4e1c\u897f(\u5982\u679c\u4f60\u6709\u63a5\u89e6\u8fc7PS\u6216FLASH\uff0c\u5e94\u8be5\u5f88\u5bb9\u6613\u7406\u89e3\"\u5c42\"\u8fd9\u4e2a\u6982\u5ff5)\uff0c\u4ee5\u4e0d\u540c\u7684\u901f\u5ea6\u79fb\u52a8\uff0c\u5f62\u6210\u7acb\u4f53\u7684\u8fd0\u52a8\u6548\u679c\u3002\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u5f53\u4f60\u5750\u5728\u884c\u9a76\u4e2d\u7684\u6c7d\u8f66\u5185\uff0c\u770b\u7740\u7a97\u5916\u8fd1\u666f\u7684\u6811\u6728\uff0c\u518d\u770b\u8fdc\u5904\u7684\u5c71\u6216\u4e8b\u7269\uff0c\u4f60\u4f1a\u53d1\u89c9\u6811\u79fb\u52a8\u7684\u5f88\u5feb\uff0c\u800c\u8fdc\u5904\u7684\u4e8b\u7269\u5374\u79fb\u52a8\u7684\u5f88\u6162\u3002\u89c6\u5dee\u6eda\u52a8\u4f7f\u7528\u76f8\u540c\u7684\u539f\u5219\u6765\u8bef\u5bfc\u4eba\u4eec\u773c\u775b\uff0c\u4ee5\u4e3a\u4ed6\u4eec\u6240\u89c2\u5bdf\u5230\u76843D\u573a\u666f\u3002\u5177\u4f53\u63cf\u8ff0\uff0c\u53ef\u4ee5\u67e5\u770b\u7ef4\u57fa\u767e\u79d1 Parallax scrolling<\/p>\n","protected":false},"author":1,"featured_media":340,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[75],"tags":[20,78,71,29,89],"class_list":["post-331","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-front-end","tag-css","tag-html","tag-jquery","tag-original","tag-parallax-scrolling"],"_links":{"self":[{"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/posts\/331"}],"collection":[{"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/comments?post=331"}],"version-history":[{"count":0,"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/posts\/331\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/media\/340"}],"wp:attachment":[{"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/media?parent=331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/categories?post=331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/tags?post=331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}