<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet href='http://feed.feedsky.com/styles/temp01.xsl' type='text/xsl' ?><!--这是一个由Feedsy提供技术支持的Feed，为了提高读者阅读的体验，以及满足用户美化自己Feed的需要，我们设计了多种精美的Feed模板，提供给大家选择，所有最终呈现出来的样式，皆由用户自愿选择使用，未经许可，任何团体和个人，请不要擅自修改样式或者盗用，这是对于用户选择权的尊重。--><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:fs="http://www.feedsky.com/namespace/feed" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link href="http://feed.feedsky.com/CSSASS" type="application/rss+xml" rel="self"></atom:link><fs:self_link href="http://feed.feedsky.com/CSSASS" type="application/rss+xml"></fs:self_link><lastBuildDate>Fri, 29 Jan 2010 13:36:27 GMT</lastBuildDate><title>CSSASS</title><description>三人行必有我师焉，择其善者而从之，其不善者而改之</description><link atom:type="text/html">http://www.cssass.com/blog</link><generator xmlns="http://www.w3.org/2005/Atom" uri="http://wordpress.org/" version="2.8.4">WordPress</generator><id xmlns="http://www.w3.org/2005/Atom">http://www.cssass.com/blog/index.php/feed/atom</id><link xmlns="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://www.cssass.com/blog/index.php/feed/atom"></link><pubDate>Fri, 29 Jan 2010 13:36:27 GMT</pubDate><item><title>简单效果——滚动展示</title><link atom:type="text/html">http://item.feedsky.com/~feedsky/CSSASS/~7351173/327288747/5460608/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>ONEBOYS</name><uri>http://www.cssass.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://www.cssass.com/blog/?p=608</id><content xmlns="http://www.w3.org/2005/Atom" type="html" xml:base="http://www.cssass.com/blog/index.php/2010/608.html">&lt;p&gt;上回的文章里提到了文字滚屏效果。是无限滚动下去的。&lt;br /&gt;
现在弄一个可控制的单步滚动效果。&lt;/p&gt;
&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_7fVFdF&quot;&gt;
&amp;lt;!DOCTYPE HTML&amp;gt;
&amp;lt;html &amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta charset=&amp;quot;utf-8&amp;quot;&amp;gt;
&amp;lt;title&amp;gt;横向滚动控制&amp;lt;/title&amp;gt;
&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
*{padding:0;margin:0;}
*{padding:0;margin:0;}
.wrap{position:relative;width:735px;overflow:hidden;}
#rollBox{overflow:hidden;margin:0 50px;}
#rollList{float:left;overflow:hidden;zoom:1;margin-right:-3000px;}  /* float,margin-right为了横版排列 */
#rollList li{float:left;display:inline;margin:15px;}
#rollList img{display:block;border:1px solid #efefef;}
.rollMenu{position:absolute;width:35px;height:80px;font-size:70px;text-decoration:none;color:#6B90DA;text-align:center;}
#rollLeft{top:20px;left:0;}
#rollRight{top:20px;right:0;}
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;div class=&amp;quot;wrap&amp;quot;&amp;gt;
		&amp;lt;a onclick=&amp;quot;scrollHori.start(this);&amp;quot; class=&amp;quot;rollMenu&amp;quot; id=&amp;quot;rollLeft&amp;quot; href=&amp;quot;javascript:;&amp;quot;&amp;gt;&amp;amp;#8249;&amp;lt;/a&amp;gt;
		&amp;lt;a onclick=&amp;quot;scrollHori.start(this);&amp;quot; class=&amp;quot;rollMenu&amp;quot; id=&amp;quot;rollRight&amp;quot; href=&amp;quot;javascript:;&amp;quot;&amp;gt;&amp;amp;#8250;&amp;lt;/a&amp;gt;
		&amp;lt;div id=&amp;quot;rollBox&amp;quot;&amp;gt;
			&amp;lt;ul id=&amp;quot;rollList&amp;quot;&amp;gt;
				&amp;lt;li&amp;gt;
					&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;95&amp;quot; width=&amp;quot;95&amp;quot; src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt;
				&amp;lt;/li&amp;gt;
				&amp;lt;li&amp;gt;
					&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;95&amp;quot; width=&amp;quot;95&amp;quot; src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt;
				&amp;lt;/li&amp;gt;
				&amp;lt;li&amp;gt;
					&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;95&amp;quot; width=&amp;quot;95&amp;quot; src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt;
				&amp;lt;/li&amp;gt;
				&amp;lt;li&amp;gt;
					&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;95&amp;quot; width=&amp;quot;95&amp;quot; src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt;
				&amp;lt;/li&amp;gt;
				&amp;lt;li&amp;gt;
					&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;95&amp;quot; width=&amp;quot;95&amp;quot; src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt;
				&amp;lt;/li&amp;gt;
				&amp;lt;li&amp;gt;
					&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;95&amp;quot; width=&amp;quot;95&amp;quot; src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt;
				&amp;lt;/li&amp;gt;
				&amp;lt;li&amp;gt;
					&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;95&amp;quot; width=&amp;quot;95&amp;quot; src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot;/&amp;gt;&amp;lt;/a&amp;gt;
				&amp;lt;/li&amp;gt;
			&amp;lt;/ul&amp;gt;
		&amp;lt;/div&amp;gt;
		&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
			var $id=function(id){ return document.getElementById(id);}
			var scrollHori={
				locked:0,
				vector:0,
				start:function(thiso){
					if (scrollHori.locked == 0){
						if (thiso.id == 'rollLeft'&amp;amp;&amp;amp;$id('rollBox').scrollLeft!=0) {
							scrollHori.vector = -5;
							scrollHori.scroll();
						}
						if (thiso.id =='rollRight'&amp;amp;&amp;amp;$id('rollBox').scrollLeft!=($id('rollList').offsetWidth-$id('rollBox').offsetWidth)){
							scrollHori.vector = 5;
							scrollHori.scroll();
						}
					}
				},
				scroll:function(){
					var step=0;
					var size=$id('rollList').offsetWidth/$id('rollList').getElementsByTagName('li').length;
					play = setInterval(function(){
							if(size&amp;gt;step){
								$id('rollBox').scrollLeft+=scrollHori.vector;
								step+=Math.abs(scrollHori.vector);
								scrollHori.locked = 1;
							}
							else{
								scrollHori.stop();
							}
						}, 5);
				},
				stop:function(){
					if (window.play) {
						clearInterval(window.play);
						scrollHori.locked = 0;
					}
				}
			}
&amp;lt;/script&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_7fVFdF');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_7fVFdF');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;hl-surround&quot;&gt;&lt;ol class=&quot;hl-main ln-show&quot; title=&quot;Double click to hide line number.&quot; ondblclick = &quot;linenumber(this)&quot;&gt;&lt;li class=&quot;hl-firstline&quot;&gt;&lt;span style=&quot;color: Green;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollHori&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;locked&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//锁死&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;vector&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//左右向量&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;start&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;thiso&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollHori&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;locked&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; == &lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;thiso&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; == &lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollLeft&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;amp;&amp;amp;$&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollBox&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollLeft&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//按到往左按钮，且在左侧有内容&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollHori&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;vector&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; = -&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollHori&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scroll&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;thiso&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; ==&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollRight&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;amp;&amp;amp;$&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollBox&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollLeft&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollList&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;offsetWidth&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;-$&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollBox&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;offsetWidth&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)){&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//按到往右按钮，且在右侧有内容&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollHori&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;vector&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollHori&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scroll&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scroll&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;step&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;size&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=$&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollList&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;offsetWidth&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;$id('rollList').getElementsByTagName('li').length;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;单个内容总宽（包括margin）&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; play = setInterval(function(){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(size&amp;gt;step){&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;单步滚动&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $id('rollBox').scrollLeft+=scrollHori.vector; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; step+=Math.abs(scrollHori.vector);&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; scrollHori.locked = 1;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;滚动的时候锁死&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; scrollHori.stop();&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }, 5);&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; },&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; stop:function(){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (window.play) {&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; clearInterval(window.play);&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;清除反复&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; scrollHori.locked = 0;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;开锁&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;竖排的话可以省力很多。&lt;br /&gt;
（不过下面的效果本来就更简单）&lt;/p&gt;
&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_AH3n5Y&quot;&gt;
&amp;lt;!DOCTYPE HTML&amp;gt;
&amp;lt;html &amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta charset=&amp;quot;utf-8&amp;quot;&amp;gt;
&amp;lt;title&amp;gt;纵向滚动控制&amp;lt;/title&amp;gt;
&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
*{padding:0;margin:0;}
a{font-size:12px;text-decoration:none;color:#6B90DA;}
.wrap{position:relative;overflow:hidden;width:140px;}
#rollBox{margin:30px 0;height:360px;overflow:hidden;}
#rollList li{height:106px;overflow:hidden;text-align:center;padding-top:13px;}
#rollList li img{display:block;margin:0 auto;border:1px solid #efefef;}
.rollMenu{position:absolute;width:140px;height:30px;line-height:30px;font-size:30px;text-align:center;}
#rollUp{top:0px;}
#rollDown{bottom:0px;}
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;div class=&amp;quot;wrap&amp;quot;&amp;gt;
&amp;lt;a onmouseout=&amp;quot;scrollVert.stop();&amp;quot; onmouseover=&amp;quot;scrollVert.play(this);&amp;quot; href=&amp;quot;javascript:;&amp;quot; id=&amp;quot;rollUp&amp;quot; class=&amp;quot;rollMenu&amp;quot;&amp;gt;&amp;amp;#9650;&amp;lt;/a&amp;gt;
&amp;lt;a onmouseout=&amp;quot;scrollVert.stop();&amp;quot; onmouseover=&amp;quot;scrollVert.play(this);&amp;quot; href=&amp;quot;javascript:;&amp;quot; id=&amp;quot;rollDown&amp;quot; class=&amp;quot;rollMenu&amp;quot;&amp;gt;&amp;amp;#9660;&amp;lt;/a&amp;gt;
&amp;lt;div id=&amp;quot;rollBox&amp;quot;&amp;gt;
	&amp;lt;ul id=&amp;quot;rollList&amp;quot;&amp;gt;
		&amp;lt;li&amp;gt;
			&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;80&amp;quot; width=&amp;quot;114&amp;quot;  src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot;/&amp;gt;我的相册&amp;lt;/a&amp;gt;
		&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;
			&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;80&amp;quot; width=&amp;quot;114&amp;quot;  src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot;/&amp;gt;我的相册&amp;lt;/a&amp;gt;
		&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;
			&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;80&amp;quot; width=&amp;quot;114&amp;quot;  src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot;/&amp;gt;我的相册&amp;lt;/a&amp;gt;
		&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;
			&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;80&amp;quot; width=&amp;quot;114&amp;quot;  src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot;/&amp;gt;我的相册&amp;lt;/a&amp;gt;
		&amp;lt;/li&amp;gt;
	&amp;lt;/ul&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
var $id=function(id){ return document.getElementById(id);}
var scrollVert={
locked: 0,
vector: 0,
play:function(thiso){
	if (scrollVert.locked == 0) {
		if (thiso.id == 'rollUp') {
			scrollVert.vector = 1;
		}
		if (thiso.id == 'rollDown') {
			scrollVert.vector = -1;
		}
		roll = setInterval(function(){
			$id('rollBox').scrollTop+=scrollVert.vector;
		}, 10);
		scrollVert.locked = 1;
	}
},
stop: function(){
	if (window.roll) {
		clearInterval(window.roll);
		scrollVert.locked = 0;
	}
}
}
&amp;lt;/script&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_AH3n5Y');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_AH3n5Y');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;


&lt;p&gt;Related posts:&lt;ol&gt;&lt;li&gt;&lt;a href='http://www.cssass.com/blog/index.php/2009/547.html' rel='bookmark' title='Permanent Link: 简单效果的简单写法——无缝滚动字幕'&gt;简单效果的简单写法——无缝滚动字幕&lt;/a&gt; &lt;small&gt; &amp;lt;style&amp;gt; *{padding:0;margin:0;font-size:12px;} #wrap{width:300px;background:#eee;} #wrap li{height:22px;line-height:22px;} &amp;lt;/style&amp;gt; &amp;lt;div id=&amp;quot;wrap&amp;quot; style=&amp;quot;overflow:hidden;height:100px;&amp;quot;&amp;gt;...&lt;/small&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;</content><thr:total>0</thr:total><description>上回的文章里提到了文字滚屏效果。是无限滚动下去的。
现在弄一个可控制的单步滚动效果。


&amp;#60;!DOCTYPE HTML&amp;#62;
&amp;#60;html &amp;#62;
&amp;#60;head&amp;#62;
&amp;#60;meta charset=&amp;#34;utf-8&amp;#34;&amp;#62;
&amp;#60;title&amp;#62;横向滚动控制&amp;#60;/title&amp;#62;
&amp;#60;style type=&amp;#34;text/css&amp;#34;&amp;#62;
*{padding:0;margin:0;}
*{padding:0;margin:0;}
.wrap{position:relative;width:735px;overflow:hidden;}
#rollBox{overflow:hidden;margin:0 50px;}
#rollList{float:left;overflow:hidden;zoom:1;margin-right:-3000px;}  /* float,margin-right为了横版排列 */
#rollList li{float:left;display:inline;margin:15px;}
#rollList img{display:block;border:1px solid #efefef;}
.rollMenu{position:absolute;width:35px;height:80px;font-size:70px;text-decoration:none;color:#6B90DA;text-align:center;}
#rollLeft{top:20px;left:0;}
#rollRight{top:20px;right:0;}
&amp;#60;/style&amp;#62;
&amp;#60;/head&amp;#62;
&amp;#60;body&amp;#62;
&amp;#60;div class=&amp;#34;wrap&amp;#34;&amp;#62;
		&amp;#60;a onclick=&amp;#34;scrollHori.start(this);&amp;#34; class=&amp;#34;rollMenu&amp;#34; id=&amp;#34;rollLeft&amp;#34; href=&amp;#34;javascript:;&amp;#34;&amp;#62;&amp;#38;#8249;&amp;#60;/a&amp;#62;
		&amp;#60;a onclick=&amp;#34;scrollHori.start(this);&amp;#34; class=&amp;#34;rollMenu&amp;#34; id=&amp;#34;rollRight&amp;#34; href=&amp;#34;javascript:;&amp;#34;&amp;#62;&amp;#38;#8250;&amp;#60;/a&amp;#62;
		&amp;#60;div id=&amp;#34;rollBox&amp;#34;&amp;#62;
			&amp;#60;ul id=&amp;#34;rollList&amp;#34;&amp;#62;
				&amp;#60;li&amp;#62;
					&amp;#60;a href=&amp;#34;#&amp;#34;&amp;#62;&amp;#60;img height=&amp;#34;95&amp;#34; width=&amp;#34;95&amp;#34; src=&amp;#34;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;#34; /&amp;#62;&amp;#60;/a&amp;#62;
				&amp;#60;/li&amp;#62;
				&amp;#60;li&amp;#62;
					&amp;#60;a href=&amp;#34;#&amp;#34;&amp;#62;&amp;#60;img height=&amp;#34;95&amp;#34; width=&amp;#34;95&amp;#34; src=&amp;#34;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;#34; /&amp;#62;&amp;#60;/a&amp;#62;
				&amp;#60;/li&amp;#62;
				&amp;#60;li&amp;#62;
					&amp;#60;a href=&amp;#34;#&amp;#34;&amp;#62;&amp;#60;img height=&amp;#34;95&amp;#34; width=&amp;#34;95&amp;#34; src=&amp;#34;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;#34; /&amp;#62;&amp;#60;/a&amp;#62;
				&amp;#60;/li&amp;#62;
				&amp;#60;li&amp;#62;
					&amp;#60;a href=&amp;#34;#&amp;#34;&amp;#62;&amp;#60;img height=&amp;#34;95&amp;#34; width=&amp;#34;95&amp;#34; src=&amp;#34;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;#34; /&amp;#62;&amp;#60;/a&amp;#62;
				&amp;#60;/li&amp;#62;
				&amp;#60;li&amp;#62;
					&amp;#60;a href=&amp;#34;#&amp;#34;&amp;#62;&amp;#60;img height=&amp;#34;95&amp;#34; width=&amp;#34;95&amp;#34; src=&amp;#34;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;#34; /&amp;#62;&amp;#60;/a&amp;#62;
				&amp;#60;/li&amp;#62;
				&amp;#60;li&amp;#62;
					&amp;#60;a href=&amp;#34;#&amp;#34;&amp;#62;&amp;#60;img height=&amp;#34;95&amp;#34; width=&amp;#34;95&amp;#34; src=&amp;#34;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;#34; /&amp;#62;&amp;#60;/a&amp;#62;
				&amp;#60;/li&amp;#62;
				&amp;#60;li&amp;#62;
					&amp;#60;a [...]


Related posts:&lt;ol&gt;&lt;li&gt;&lt;a href='http://www.cssass.com/blog/index.php/2009/547.html' rel='bookmark' title='Permanent Link: 简单效果的简单写法——无缝滚动字幕'&gt;简单效果的简单写法——无缝滚动字幕&lt;/a&gt; &lt;small&gt; &amp;lt;style&amp;gt; *{padding:0;margin:0;font-size:12px;} #wrap{width:300px;background:#eee;} #wrap li{height:22px;line-height:22px;} &amp;lt;/style&amp;gt; &amp;lt;div id=&amp;quot;wrap&amp;quot; style=&amp;quot;overflow:hidden;height:100px;&amp;quot;&amp;gt;...&lt;/small&gt;&lt;/li&gt;&lt;/ol&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/327288747/CSSASS/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/CSSASS/~7351173/327288747/5460608/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/CSSASS/327288747/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/CSSASS/327288747/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</description><content:encoded>&lt;p&gt;上回的文章里提到了文字滚屏效果。是无限滚动下去的。&lt;br /&gt;
现在弄一个可控制的单步滚动效果。&lt;/p&gt;
&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_7fVFdF&quot;&gt;
&amp;lt;!DOCTYPE HTML&amp;gt;
&amp;lt;html &amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta charset=&amp;quot;utf-8&amp;quot;&amp;gt;
&amp;lt;title&amp;gt;横向滚动控制&amp;lt;/title&amp;gt;
&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
*{padding:0;margin:0;}
*{padding:0;margin:0;}
.wrap{position:relative;width:735px;overflow:hidden;}
#rollBox{overflow:hidden;margin:0 50px;}
#rollList{float:left;overflow:hidden;zoom:1;margin-right:-3000px;}  /* float,margin-right为了横版排列 */
#rollList li{float:left;display:inline;margin:15px;}
#rollList img{display:block;border:1px solid #efefef;}
.rollMenu{position:absolute;width:35px;height:80px;font-size:70px;text-decoration:none;color:#6B90DA;text-align:center;}
#rollLeft{top:20px;left:0;}
#rollRight{top:20px;right:0;}
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;div class=&amp;quot;wrap&amp;quot;&amp;gt;
		&amp;lt;a onclick=&amp;quot;scrollHori.start(this);&amp;quot; class=&amp;quot;rollMenu&amp;quot; id=&amp;quot;rollLeft&amp;quot; href=&amp;quot;javascript:;&amp;quot;&amp;gt;&amp;amp;#8249;&amp;lt;/a&amp;gt;
		&amp;lt;a onclick=&amp;quot;scrollHori.start(this);&amp;quot; class=&amp;quot;rollMenu&amp;quot; id=&amp;quot;rollRight&amp;quot; href=&amp;quot;javascript:;&amp;quot;&amp;gt;&amp;amp;#8250;&amp;lt;/a&amp;gt;
		&amp;lt;div id=&amp;quot;rollBox&amp;quot;&amp;gt;
			&amp;lt;ul id=&amp;quot;rollList&amp;quot;&amp;gt;
				&amp;lt;li&amp;gt;
					&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;95&amp;quot; width=&amp;quot;95&amp;quot; src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt;
				&amp;lt;/li&amp;gt;
				&amp;lt;li&amp;gt;
					&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;95&amp;quot; width=&amp;quot;95&amp;quot; src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt;
				&amp;lt;/li&amp;gt;
				&amp;lt;li&amp;gt;
					&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;95&amp;quot; width=&amp;quot;95&amp;quot; src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt;
				&amp;lt;/li&amp;gt;
				&amp;lt;li&amp;gt;
					&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;95&amp;quot; width=&amp;quot;95&amp;quot; src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt;
				&amp;lt;/li&amp;gt;
				&amp;lt;li&amp;gt;
					&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;95&amp;quot; width=&amp;quot;95&amp;quot; src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt;
				&amp;lt;/li&amp;gt;
				&amp;lt;li&amp;gt;
					&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;95&amp;quot; width=&amp;quot;95&amp;quot; src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt;
				&amp;lt;/li&amp;gt;
				&amp;lt;li&amp;gt;
					&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;95&amp;quot; width=&amp;quot;95&amp;quot; src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot;/&amp;gt;&amp;lt;/a&amp;gt;
				&amp;lt;/li&amp;gt;
			&amp;lt;/ul&amp;gt;
		&amp;lt;/div&amp;gt;
		&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
			var $id=function(id){ return document.getElementById(id);}
			var scrollHori={
				locked:0,
				vector:0,
				start:function(thiso){
					if (scrollHori.locked == 0){
						if (thiso.id == 'rollLeft'&amp;amp;&amp;amp;$id('rollBox').scrollLeft!=0) {
							scrollHori.vector = -5;
							scrollHori.scroll();
						}
						if (thiso.id =='rollRight'&amp;amp;&amp;amp;$id('rollBox').scrollLeft!=($id('rollList').offsetWidth-$id('rollBox').offsetWidth)){
							scrollHori.vector = 5;
							scrollHori.scroll();
						}
					}
				},
				scroll:function(){
					var step=0;
					var size=$id('rollList').offsetWidth/$id('rollList').getElementsByTagName('li').length;
					play = setInterval(function(){
							if(size&amp;gt;step){
								$id('rollBox').scrollLeft+=scrollHori.vector;
								step+=Math.abs(scrollHori.vector);
								scrollHori.locked = 1;
							}
							else{
								scrollHori.stop();
							}
						}, 5);
				},
				stop:function(){
					if (window.play) {
						clearInterval(window.play);
						scrollHori.locked = 0;
					}
				}
			}
&amp;lt;/script&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_7fVFdF');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_7fVFdF');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;hl-surround&quot;&gt;&lt;ol class=&quot;hl-main ln-show&quot; title=&quot;Double click to hide line number.&quot; ondblclick = &quot;linenumber(this)&quot;&gt;&lt;li class=&quot;hl-firstline&quot;&gt;&lt;span style=&quot;color: Green;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollHori&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;locked&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//锁死&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;vector&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//左右向量&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;start&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;thiso&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollHori&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;locked&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; == &lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;thiso&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; == &lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollLeft&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;amp;&amp;amp;$&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollBox&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollLeft&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//按到往左按钮，且在左侧有内容&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollHori&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;vector&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; = -&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollHori&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scroll&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;thiso&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; ==&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollRight&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;amp;&amp;amp;$&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollBox&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollLeft&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollList&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;offsetWidth&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;-$&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollBox&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;offsetWidth&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)){&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//按到往右按钮，且在右侧有内容&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollHori&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;vector&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollHori&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scroll&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scroll&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;step&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;size&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=$&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollList&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;offsetWidth&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;$id('rollList').getElementsByTagName('li').length;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;单个内容总宽（包括margin）&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; play = setInterval(function(){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(size&amp;gt;step){&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;单步滚动&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $id('rollBox').scrollLeft+=scrollHori.vector; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; step+=Math.abs(scrollHori.vector);&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; scrollHori.locked = 1;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;滚动的时候锁死&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; scrollHori.stop();&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }, 5);&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; },&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; stop:function(){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (window.play) {&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; clearInterval(window.play);&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;清除反复&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; scrollHori.locked = 0;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;开锁&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;竖排的话可以省力很多。&lt;br /&gt;
（不过下面的效果本来就更简单）&lt;/p&gt;
&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_AH3n5Y&quot;&gt;
&amp;lt;!DOCTYPE HTML&amp;gt;
&amp;lt;html &amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta charset=&amp;quot;utf-8&amp;quot;&amp;gt;
&amp;lt;title&amp;gt;纵向滚动控制&amp;lt;/title&amp;gt;
&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
*{padding:0;margin:0;}
a{font-size:12px;text-decoration:none;color:#6B90DA;}
.wrap{position:relative;overflow:hidden;width:140px;}
#rollBox{margin:30px 0;height:360px;overflow:hidden;}
#rollList li{height:106px;overflow:hidden;text-align:center;padding-top:13px;}
#rollList li img{display:block;margin:0 auto;border:1px solid #efefef;}
.rollMenu{position:absolute;width:140px;height:30px;line-height:30px;font-size:30px;text-align:center;}
#rollUp{top:0px;}
#rollDown{bottom:0px;}
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;div class=&amp;quot;wrap&amp;quot;&amp;gt;
&amp;lt;a onmouseout=&amp;quot;scrollVert.stop();&amp;quot; onmouseover=&amp;quot;scrollVert.play(this);&amp;quot; href=&amp;quot;javascript:;&amp;quot; id=&amp;quot;rollUp&amp;quot; class=&amp;quot;rollMenu&amp;quot;&amp;gt;&amp;amp;#9650;&amp;lt;/a&amp;gt;
&amp;lt;a onmouseout=&amp;quot;scrollVert.stop();&amp;quot; onmouseover=&amp;quot;scrollVert.play(this);&amp;quot; href=&amp;quot;javascript:;&amp;quot; id=&amp;quot;rollDown&amp;quot; class=&amp;quot;rollMenu&amp;quot;&amp;gt;&amp;amp;#9660;&amp;lt;/a&amp;gt;
&amp;lt;div id=&amp;quot;rollBox&amp;quot;&amp;gt;
	&amp;lt;ul id=&amp;quot;rollList&amp;quot;&amp;gt;
		&amp;lt;li&amp;gt;
			&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;80&amp;quot; width=&amp;quot;114&amp;quot;  src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot;/&amp;gt;我的相册&amp;lt;/a&amp;gt;
		&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;
			&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;80&amp;quot; width=&amp;quot;114&amp;quot;  src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot;/&amp;gt;我的相册&amp;lt;/a&amp;gt;
		&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;
			&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;80&amp;quot; width=&amp;quot;114&amp;quot;  src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot;/&amp;gt;我的相册&amp;lt;/a&amp;gt;
		&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;
			&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;img height=&amp;quot;80&amp;quot; width=&amp;quot;114&amp;quot;  src=&amp;quot;http://th04.deviantart.net/fs13/150/f/2009/113/f/e/fe84cff8156cbec59b1fff91faea18b6.jpg&amp;quot;/&amp;gt;我的相册&amp;lt;/a&amp;gt;
		&amp;lt;/li&amp;gt;
	&amp;lt;/ul&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
var $id=function(id){ return document.getElementById(id);}
var scrollVert={
locked: 0,
vector: 0,
play:function(thiso){
	if (scrollVert.locked == 0) {
		if (thiso.id == 'rollUp') {
			scrollVert.vector = 1;
		}
		if (thiso.id == 'rollDown') {
			scrollVert.vector = -1;
		}
		roll = setInterval(function(){
			$id('rollBox').scrollTop+=scrollVert.vector;
		}, 10);
		scrollVert.locked = 1;
	}
},
stop: function(){
	if (window.roll) {
		clearInterval(window.roll);
		scrollVert.locked = 0;
	}
}
}
&amp;lt;/script&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_AH3n5Y');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_AH3n5Y');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;


&lt;p&gt;Related posts:&lt;ol&gt;&lt;li&gt;&lt;a href='http://www.cssass.com/blog/index.php/2009/547.html' rel='bookmark' title='Permanent Link: 简单效果的简单写法——无缝滚动字幕'&gt;简单效果的简单写法——无缝滚动字幕&lt;/a&gt; &lt;small&gt; &amp;lt;style&amp;gt; *{padding:0;margin:0;font-size:12px;} #wrap{width:300px;background:#eee;} #wrap li{height:22px;line-height:22px;} &amp;lt;/style&amp;gt; &amp;lt;div id=&amp;quot;wrap&amp;quot; style=&amp;quot;overflow:hidden;height:100px;&amp;quot;&amp;gt;...&lt;/small&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/327288747/CSSASS/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/CSSASS/~7351173/327288747/5460608/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/CSSASS/327288747/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/CSSASS/327288747/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><category domain="http://www.cssass.com/blog">javascript</category><category domain="http://www.cssass.com/blog">js动画</category><category domain="http://www.cssass.com/blog">setInterval</category><category domain="http://www.cssass.com/blog">滚动展示</category><pubDate>Fri, 29 Jan 2010 21:36:27 +0800</pubDate><guid isPermaLink="false">http://www.cssass.com/blog/?p=608</guid><dc:creator>ONEBOYS</dc:creator><fs:srclink>http://www.cssass.com/blog/index.php/2010/608.html</fs:srclink><fs:srcfeed>http://www.cssass.com/blog/index.php/feed/atom</fs:srcfeed><fs:itemid>feedsky/CSSASS/~7351173/327288747/5460608</fs:itemid></item><item><title>简单效果——地图移动</title><link atom:type="text/html">http://item.feedsky.com/~feedsky/CSSASS/~7351173/327288746/5460608/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>ONEBOYS</name><uri>http://www.cssass.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://www.cssass.com/blog/?p=606</id><content xmlns="http://www.w3.org/2005/Atom" type="html" xml:base="http://www.cssass.com/blog/index.php/2010/606.html">&lt;p&gt;记得上回弄的简单文字滚屏效果，&lt;a href=&quot;/?p=547&quot;&gt;无缝滚动字幕&lt;/a&gt;。&lt;br /&gt;
其实应用的地方还是蛮多的。我们也可以做个简单的地图移动效果。&lt;/p&gt;
&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_JTukcq&quot;&gt;
&amp;lt;!doctype html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta charset=&amp;quot;utf-8&amp;quot; /&amp;gt;
&amp;lt;title&amp;gt;地图移动控制&amp;lt;/title&amp;gt;
&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
*{padding:0;margin:0;}
html,body{height:100%;overflow:hidden;}
#control{position:absolute;top:10px;left:10px;width:58px;height:58px;z-index:10;background:url(http://capi3.edushi.com/Images/ZoomBarControl.gif) no-repeat;}
#control i{position:absolute;width:15px;height:15px;text-indent:-10000px;cursor:pointer;}
#rollUp{bottom:0;left:20px;}
#rollDown{top:0;left:20px;}
#rollLeft{top:20px;right:0;}
#rollRight{top:20px;left:0;}
#albumRoll{position:relative;height:100%;width:80%;overflow:hidden;border:2px solid #ccf;}
#albumList{position:absolute;}
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;div id=&amp;quot;control&amp;quot;&amp;gt;
	&amp;lt;i id=&amp;quot;rollUp&amp;quot; onmousedown=&amp;quot;map.scroll(this);&amp;quot; onmouseup=&amp;quot;map.stop(this);&amp;quot;&amp;gt;向上&amp;lt;/i&amp;gt;
	&amp;lt;i id=&amp;quot;rollDown&amp;quot; onmousedown=&amp;quot;map.scroll(this);&amp;quot; onmouseup=&amp;quot;map.stop(this);&amp;quot;&amp;gt;向下&amp;lt;/i&amp;gt;
	&amp;lt;i id=&amp;quot;rollLeft&amp;quot; onmousedown=&amp;quot;map.scroll(this);&amp;quot; onmouseup=&amp;quot;map.stop(this);&amp;quot;&amp;gt;向左&amp;lt;/i&amp;gt;
	&amp;lt;i id=&amp;quot;rollRight&amp;quot; onmousedown=&amp;quot;map.scroll(this);&amp;quot; onmouseup=&amp;quot;map.stop(this);&amp;quot;&amp;gt;向右&amp;lt;/i&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;div id=&amp;quot;albumRoll&amp;quot;&amp;gt;
	&amp;lt;img id=&amp;quot;albumList&amp;quot; onload=&amp;quot;map.initial()&amp;quot; src=&amp;quot;http://www.onegreen.net/maps/Upload_maps/200812/20081225213951966.jpg&amp;quot; /&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
var $id=function(id){ return document.getElementById(id);}
var map={
	locked:0,
	initial:function(){
		$id('albumRoll').scrollLeft=($id('albumList').scrollWidth-$id('albumRoll').offsetWidth)/2;
		$id('albumRoll').scrollTop=($id('albumList').scrollHeight-$id('albumRoll').offsetHeight)/2;
	},
	scroll:function(othis){
		if (map.locked==0){
			var x=0,y=0;
			if(othis.id=='rollUp'){
				y=2;
			}
			if(othis.id=='rollDown'){
				y=-2;
			}
			if(othis.id=='rollLeft'){
				x=2;
			}
			if(othis.id=='rollRight'){
				x=-2;
			}
			roll = setInterval(function(){
				$id('albumRoll').scrollLeft+=x;
				$id('albumRoll').scrollTop+=y;
			}, 5);
			map.locked=1;
		}
	},
	stop:function (){
		if (roll){
			clearInterval(roll);
			map.locked = 0;
		}}
}
&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_JTukcq');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_JTukcq');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;hl-surround&quot;&gt;&lt;ol class=&quot;hl-main ln-show&quot; title=&quot;Double click to hide line number.&quot; ondblclick = &quot;linenumber(this)&quot;&gt;&lt;li class=&quot;hl-firstline&quot;&gt;&lt;span style=&quot;color: Green;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; $&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: Teal;&quot;&gt;document&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;getElementById&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Green;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;map&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;locked&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;initial&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(){&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//初始图片位置为居中&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;albumRoll&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollLeft&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;albumList&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollWidth&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;-$&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;albumRoll&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;offsetWidth&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;2;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $id('albumRoll').scrollTop=($id('albumList').scrollHeight-$id('albumRoll').offsetHeight)&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scroll&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;othis&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;map&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;locked&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;othis&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollUp&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//滚动向量（上2）&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;othis&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollDown&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=-&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;othis&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollLeft&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;othis&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollRight&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=-&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;roll&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;setInterval&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;albumRoll&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollLeft&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;albumRoll&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollTop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;map&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;locked&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;stop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;roll&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;clearInterval&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;roll&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;map&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;locked&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}}&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;


&lt;p&gt;No related posts.&lt;/p&gt;</content><thr:total>0</thr:total><description>记得上回弄的简单文字滚屏效果，无缝滚动字幕。
其实应用的地方还是蛮多的。我们也可以做个简单的地图移动效果。


&amp;#60;!doctype html&amp;#62;
&amp;#60;html&amp;#62;
&amp;#60;head&amp;#62;
&amp;#60;meta charset=&amp;#34;utf-8&amp;#34; /&amp;#62;
&amp;#60;title&amp;#62;地图移动控制&amp;#60;/title&amp;#62;
&amp;#60;style type=&amp;#34;text/css&amp;#34;&amp;#62;
*{padding:0;margin:0;}
html,body{height:100%;overflow:hidden;}
#control{position:absolute;top:10px;left:10px;width:58px;height:58px;z-index:10;background:url(http://capi3.edushi.com/Images/ZoomBarControl.gif) no-repeat;}
#control i{position:absolute;width:15px;height:15px;text-indent:-10000px;cursor:pointer;}
#rollUp{bottom:0;left:20px;}
#rollDown{top:0;left:20px;}
#rollLeft{top:20px;right:0;}
#rollRight{top:20px;left:0;}
#albumRoll{position:relative;height:100%;width:80%;overflow:hidden;border:2px solid #ccf;}
#albumList{position:absolute;}
&amp;#60;/style&amp;#62;
&amp;#60;/head&amp;#62;
&amp;#60;body&amp;#62;
&amp;#60;div id=&amp;#34;control&amp;#34;&amp;#62;
	&amp;#60;i id=&amp;#34;rollUp&amp;#34; onmousedown=&amp;#34;map.scroll(this);&amp;#34; onmouseup=&amp;#34;map.stop(this);&amp;#34;&amp;#62;向上&amp;#60;/i&amp;#62;
	&amp;#60;i id=&amp;#34;rollDown&amp;#34; onmousedown=&amp;#34;map.scroll(this);&amp;#34; onmouseup=&amp;#34;map.stop(this);&amp;#34;&amp;#62;向下&amp;#60;/i&amp;#62;
	&amp;#60;i id=&amp;#34;rollLeft&amp;#34; onmousedown=&amp;#34;map.scroll(this);&amp;#34; onmouseup=&amp;#34;map.stop(this);&amp;#34;&amp;#62;向左&amp;#60;/i&amp;#62;
	&amp;#60;i id=&amp;#34;rollRight&amp;#34; onmousedown=&amp;#34;map.scroll(this);&amp;#34; onmouseup=&amp;#34;map.stop(this);&amp;#34;&amp;#62;向右&amp;#60;/i&amp;#62;
&amp;#60;/div&amp;#62;
&amp;#60;div id=&amp;#34;albumRoll&amp;#34;&amp;#62;
	&amp;#60;img id=&amp;#34;albumList&amp;#34; onload=&amp;#34;map.initial()&amp;#34; src=&amp;#34;http://www.onegreen.net/maps/Upload_maps/200812/20081225213951966.jpg&amp;#34; /&amp;#62;
&amp;#60;/div&amp;#62;
&amp;#60;script type=&amp;#34;text/javascript&amp;#34;&amp;#62;
var $id=function(id){ return document.getElementById(id);}
var map={
	locked:0,
	initial:function(){
		$id('albumRoll').scrollLeft=($id('albumList').scrollWidth-$id('albumRoll').offsetWidth)/2;
		$id('albumRoll').scrollTop=($id('albumList').scrollHeight-$id('albumRoll').offsetHeight)/2;
	},
	scroll:function(othis){
		if (map.locked==0){
			var x=0,y=0;
			if(othis.id=='rollUp'){
				y=2;
			}
			if(othis.id=='rollDown'){
				y=-2;
			}
			if(othis.id=='rollLeft'){
				x=2;
			}
			if(othis.id=='rollRight'){
				x=-2;
			}
			roll = setInterval(function(){
				$id('albumRoll').scrollLeft+=x;
				$id('albumRoll').scrollTop+=y;
			}, 5);
			map.locked=1;
		}
	},
	stop:function (){
		if (roll){
			clearInterval(roll);
			map.locked = 0;
		}}
}
&amp;#60;/script&amp;#62;
&amp;#60;/body&amp;#62;
&amp;#60;/html&amp;#62;

  

var $id=function(id){ return document.getElementById(id);}
var&amp;#160;map={
&amp;#160; &amp;#160; locked:0,
&amp;#160; &amp;#160; initial:function(){&amp;#160; &amp;#160; &amp;#160; &amp;#160;&amp;#160; //初始图片位置为居中
&amp;#160; &amp;#160; [...]


No related posts.&lt;img src=&quot;http://www1.feedsky.com/t1/327288746/CSSASS/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/CSSASS/~7351173/327288746/5460608/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/CSSASS/327288746/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/CSSASS/327288746/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</description><content:encoded>&lt;p&gt;记得上回弄的简单文字滚屏效果，&lt;a href=&quot;/?p=547&quot;&gt;无缝滚动字幕&lt;/a&gt;。&lt;br /&gt;
其实应用的地方还是蛮多的。我们也可以做个简单的地图移动效果。&lt;/p&gt;
&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_JTukcq&quot;&gt;
&amp;lt;!doctype html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta charset=&amp;quot;utf-8&amp;quot; /&amp;gt;
&amp;lt;title&amp;gt;地图移动控制&amp;lt;/title&amp;gt;
&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
*{padding:0;margin:0;}
html,body{height:100%;overflow:hidden;}
#control{position:absolute;top:10px;left:10px;width:58px;height:58px;z-index:10;background:url(http://capi3.edushi.com/Images/ZoomBarControl.gif) no-repeat;}
#control i{position:absolute;width:15px;height:15px;text-indent:-10000px;cursor:pointer;}
#rollUp{bottom:0;left:20px;}
#rollDown{top:0;left:20px;}
#rollLeft{top:20px;right:0;}
#rollRight{top:20px;left:0;}
#albumRoll{position:relative;height:100%;width:80%;overflow:hidden;border:2px solid #ccf;}
#albumList{position:absolute;}
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;div id=&amp;quot;control&amp;quot;&amp;gt;
	&amp;lt;i id=&amp;quot;rollUp&amp;quot; onmousedown=&amp;quot;map.scroll(this);&amp;quot; onmouseup=&amp;quot;map.stop(this);&amp;quot;&amp;gt;向上&amp;lt;/i&amp;gt;
	&amp;lt;i id=&amp;quot;rollDown&amp;quot; onmousedown=&amp;quot;map.scroll(this);&amp;quot; onmouseup=&amp;quot;map.stop(this);&amp;quot;&amp;gt;向下&amp;lt;/i&amp;gt;
	&amp;lt;i id=&amp;quot;rollLeft&amp;quot; onmousedown=&amp;quot;map.scroll(this);&amp;quot; onmouseup=&amp;quot;map.stop(this);&amp;quot;&amp;gt;向左&amp;lt;/i&amp;gt;
	&amp;lt;i id=&amp;quot;rollRight&amp;quot; onmousedown=&amp;quot;map.scroll(this);&amp;quot; onmouseup=&amp;quot;map.stop(this);&amp;quot;&amp;gt;向右&amp;lt;/i&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;div id=&amp;quot;albumRoll&amp;quot;&amp;gt;
	&amp;lt;img id=&amp;quot;albumList&amp;quot; onload=&amp;quot;map.initial()&amp;quot; src=&amp;quot;http://www.onegreen.net/maps/Upload_maps/200812/20081225213951966.jpg&amp;quot; /&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
var $id=function(id){ return document.getElementById(id);}
var map={
	locked:0,
	initial:function(){
		$id('albumRoll').scrollLeft=($id('albumList').scrollWidth-$id('albumRoll').offsetWidth)/2;
		$id('albumRoll').scrollTop=($id('albumList').scrollHeight-$id('albumRoll').offsetHeight)/2;
	},
	scroll:function(othis){
		if (map.locked==0){
			var x=0,y=0;
			if(othis.id=='rollUp'){
				y=2;
			}
			if(othis.id=='rollDown'){
				y=-2;
			}
			if(othis.id=='rollLeft'){
				x=2;
			}
			if(othis.id=='rollRight'){
				x=-2;
			}
			roll = setInterval(function(){
				$id('albumRoll').scrollLeft+=x;
				$id('albumRoll').scrollTop+=y;
			}, 5);
			map.locked=1;
		}
	},
	stop:function (){
		if (roll){
			clearInterval(roll);
			map.locked = 0;
		}}
}
&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_JTukcq');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_JTukcq');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;hl-surround&quot;&gt;&lt;ol class=&quot;hl-main ln-show&quot; title=&quot;Double click to hide line number.&quot; ondblclick = &quot;linenumber(this)&quot;&gt;&lt;li class=&quot;hl-firstline&quot;&gt;&lt;span style=&quot;color: Green;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; $&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: Teal;&quot;&gt;document&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;getElementById&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Green;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;map&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;locked&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;initial&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(){&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//初始图片位置为居中&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;albumRoll&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollLeft&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;albumList&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollWidth&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;-$&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;albumRoll&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;offsetWidth&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;2;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $id('albumRoll').scrollTop=($id('albumList').scrollHeight-$id('albumRoll').offsetHeight)&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scroll&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;othis&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;map&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;locked&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;othis&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollUp&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//滚动向量（上2）&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;othis&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollDown&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=-&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;othis&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollLeft&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;othis&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;rollRight&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=-&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;roll&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;setInterval&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;albumRoll&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollLeft&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;albumRoll&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollTop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;map&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;locked&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;stop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;roll&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;clearInterval&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;roll&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;map&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;locked&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}}&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;


&lt;p&gt;No related posts.&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/327288746/CSSASS/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/CSSASS/~7351173/327288746/5460608/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/CSSASS/327288746/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/CSSASS/327288746/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><category domain="http://www.cssass.com/blog">javascript</category><category domain="http://www.cssass.com/blog">gis</category><category domain="http://www.cssass.com/blog">地图控制</category><pubDate>Fri, 29 Jan 2010 17:54:04 +0800</pubDate><guid isPermaLink="false">http://www.cssass.com/blog/?p=606</guid><dc:creator>ONEBOYS</dc:creator><fs:srclink>http://www.cssass.com/blog/index.php/2010/606.html</fs:srclink><fs:srcfeed>http://www.cssass.com/blog/index.php/feed/atom</fs:srcfeed><fs:itemid>feedsky/CSSASS/~7351173/327288746/5460608</fs:itemid></item><item><title>简单效果的简单写法——无缝滚动字幕</title><link atom:type="text/html">http://item.feedsky.com/~feedsky/CSSASS/~7351173/327288750/5460608/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>ONEBOYS</name><uri>http://www.cssass.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://www.cssass.com/blog/?p=547</id><content xmlns="http://www.w3.org/2005/Atom" type="html" xml:base="http://www.cssass.com/blog/index.php/2009/547.html">&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_ADqq7x&quot;&gt;
&amp;lt;style&amp;gt;
	*{padding:0;margin:0;font-size:12px;}
	#wrap{width:300px;background:#eee;}
	#wrap li{height:22px;line-height:22px;}
&amp;lt;/style&amp;gt;
&amp;lt;div id=&amp;quot;wrap&amp;quot; style=&amp;quot;overflow:hidden;height:100px;&amp;quot;&amp;gt;  &amp;lt;!--  height值一定要比box1的offsetHeight(亦即box2的offsetTop)要小 --&amp;gt;
	&amp;lt;ul id=&amp;quot;box1&amp;quot;&amp;gt;
		&amp;lt;li&amp;gt;1 &amp;lt;a href=&amp;quot;#&amp;quot; title=&amp;quot;信息公开工作&amp;quot;&amp;gt;信息公开工作&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;2 &amp;lt;a href=&amp;quot;#&amp;quot; title=&amp;quot;信息公开工作&amp;quot;&amp;gt;国务院办公厅转发监察部等部门 &amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;3 &amp;lt;a href=&amp;quot;#&amp;quot; title=&amp;quot;信息公开工作&amp;quot;&amp;gt;我市将严查损害发展环境问题&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;4 &amp;lt;a href=&amp;quot;#&amp;quot; title=&amp;quot;办公时间调整通知&amp;quot;&amp;gt;办公时间调整通知&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;5 &amp;lt;a href=&amp;quot;#&amp;quot; title=&amp;quot;办公时间调整通知&amp;quot;&amp;gt;办公时间调整通知d&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
	&amp;lt;/ul&amp;gt;
	&amp;lt;ul id=&amp;quot;box2&amp;quot;&amp;gt;&amp;lt;/ul&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;!-- 无他，放参考值尔 --&amp;gt;
&amp;lt;div id=&amp;quot;refer&amp;quot;&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
		var speed=50;
		var $$=function(id){return document.getElementById(id);}
		$$('box2').innerHTML=box1.innerHTML;
		function roll(){
			if($$('box2').offsetTop-$$('wrap').scrollTop&amp;lt;=0)  {  //当滚动到第二部分的顶部位置时
				$$('wrap').scrollTop-=$$('box1').offsetHeight;	  //重置至第一部分顶部位置,相当于$$('box').scrollTop=0;
				}
			else{
				$$('wrap').scrollTop++ ;
				$$('refer').innerHTML=$$('box2').offsetTop+' '+$$('wrap').offsetHeight+' '+$$('wrap').scrollTop  //无他，参考值尔
			}
		}
		var start=setInterval(roll,speed);
		$$('wrap').onmouseover=function() {clearInterval(start)};
		$$('wrap').onmouseout=function() {start=setInterval(roll,speed)};
&amp;lt;/script&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_ADqq7x');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_ADqq7x');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;先看看无缝滚动的效果，使用window的setInterval方法重复调用一个滚动函数。&lt;br /&gt;
关键的代码是&lt;/p&gt;
&lt;div class=&quot;hl-surround&quot;&gt;&lt;ol class=&quot;hl-main ln-show&quot; title=&quot;Double click to hide line number.&quot; ondblclick = &quot;linenumber(this)&quot;&gt;&lt;li class=&quot;hl-firstline&quot;&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;roll&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(){&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;$$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;box2&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;offsetTop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;-$$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;wrap&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollTop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//当滚动到第二部分的顶部位置时&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;wrap&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollTop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;-=$$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;box1&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;offsetHeight&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//重置至第一部分顶部位置,相当于$$('box').scrollTop=0;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;wrap&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollTop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;++ ;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;refer&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;innerHTML&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=$$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;box2&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;offsetTop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;+$$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;wrap&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;offsetHeight&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;+$$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;wrap&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollTop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//无他，参考值尔&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Green;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;start&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;setInterval&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;roll&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;speed&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;而无缝的关键还在这里&lt;/p&gt;
&lt;div class=&quot;hl-surround&quot;&gt;&lt;ol class=&quot;hl-main ln-show&quot; title=&quot;Double click to hide line number.&quot; ondblclick = &quot;linenumber(this)&quot;&gt;&lt;li class=&quot;hl-firstline&quot;&gt;&lt;span style=&quot;color: Gray;&quot;&gt;$$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;box2&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;innerHTML&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;box1&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;innerHTML&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//拷贝一份内容跟随其后，使原内容之后还有内容&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;我原本要做的效果并非全如上面，我需要的效果是：&lt;b&gt;单条为一步阶，进行间歇性循环无缝滚动&lt;/b&gt;。&lt;/p&gt;
&lt;p&gt;其实提起滚动，应该立马会想起走马灯（marquee）。尽管对其一直有偏见，但我还是会给他个机会的。。。&lt;/p&gt;
&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_4IOmaF&quot;&gt;
&amp;lt;style&amp;gt;
	*{padding:0;margin:0;}
	#quee li{height:30px;line-height:30px;}
&amp;lt;/style&amp;gt;
&amp;lt;div style=&amp;quot;border:1px solid #ccc;&amp;quot;&amp;gt;
	&amp;lt;marquee id=&amp;quot;quee&amp;quot; direction=up scrollamount=&amp;quot;3&amp;quot;scrolldelay=&amp;quot;0&amp;quot; style=&amp;quot;height:30px;&amp;quot; &amp;gt;
	&amp;lt;ul&amp;gt;
		&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;1两会会谈在即陈云 抵台 台湾警方加强维安。(09-09:15)&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;2两会会谈在即陈云 抵台 台湾警方加强维安。(09-09:15)&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;3两会会谈在即陈云 抵台 台湾警方加强维安。(09-09:15)&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;4两会会谈在即陈云 抵台 台湾警方加强维安。(09-09:15)&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;5两会会谈在即陈云 抵台 台湾警方加强维安。(09-09:15)&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;6两会会谈在即陈云 抵台 台湾警方加强维安。(09-09:15)&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
	&amp;lt;/ul&amp;gt;
	&amp;lt;/marquee&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;!-- --&amp;gt;
&amp;lt;div id=&amp;quot;cc&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
	var $$=function(id){return document.getElementById(id);}
	var quee=document.getElementById('quee');
	setTimeout(func,1000);
	function func(){
		$$('quee').stop();
		setTimeout(func2,1000);
		$$('cc').innerHTML=$$('quee').scrollTop;  //参考值
	}
	function func2(){
		$$('quee').start();
		setTimeout(func,1000);
	}
 &amp;lt;/script&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_4IOmaF');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_4IOmaF');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;hl-surround&quot;&gt;&lt;ol class=&quot;hl-main ln-show&quot; title=&quot;Double click to hide line number.&quot; ondblclick = &quot;linenumber(this)&quot;&gt;&lt;li class=&quot;hl-firstline&quot;&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;func&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;quee&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;stop&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;setTimeout&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;func2&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;1000&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;func2&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;quee&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;start&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;setTimeout&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;func&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;1000&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;延时1秒交叉调用marquee的内置函数start()和stop();&lt;/p&gt;
&lt;p&gt;不过，scrollamount影响的步阶不准确啊，而且不能做到无缝么。好，将marquee拖出去斩了（marquee:冤枉啊~~~~~）&lt;/p&gt;
&lt;p&gt;下面是新的做法&lt;/p&gt;
&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_gMzioD&quot;&gt;
&amp;lt;style&amp;gt;
	*{padding:0;margin:0;}
	#wrap li{height:30px;line-height:30px;}
&amp;lt;/style&amp;gt;
&amp;lt;div id=&amp;quot;wrap&amp;quot; style=&amp;quot;height:30px;overflow:hidden;background:#eee&amp;quot; &amp;gt;  &amp;lt;!-- 注意这里的高度值要匹配 --&amp;gt;
	&amp;lt;ul id=&amp;quot;box1&amp;quot;&amp;gt;
		&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;1两会会谈在即陈抵台 台湾警方加强维安。(09-09:15)&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;2两会会谈在即a抵台 台湾警方加强维安。(09-09:15)&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;3两会会谈在即s抵台 台湾警方加强维安。(09-09:15)&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
	&amp;lt;/ul&amp;gt;
	&amp;lt;ul id=&amp;quot;box2&amp;quot;&amp;gt;
	&amp;lt;/ul&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;!-- --&amp;gt;
 &amp;lt;div id=&amp;quot;cc&amp;quot;&amp;gt; &amp;lt;/div&amp;gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
	var $$=function(id){return document.getElementById(id);}
	var start;
	$$('box2').innerHTML=$$('box1').innerHTML;
	function roll(){
		wrap.scrollTop++;
		$$('cc').innerHTML=wrap.scrollTop;   //无用，纯粹做参考数值
		 if($$('box1').offsetHeight-wrap.scrollTop&amp;gt;0){  //尚未滚动到第二部分的顶部位置时
			 if(wrap.scrollTop%wrap.offsetHeight!=0)  //
			 {
				return(setTimeout(roll,20));	 //20毫秒即递归一次
			 }
			 else{						//当滚动的累计距离达到显示域高度的倍数时
				return(setTimeout(roll,2000));  //等待2秒才递归调用
			 }
		 }
		 else{
				setTimeout(&amp;quot;$$('wrap').scrollTop=0;roll()&amp;quot;,2000);
			}
	}
	setTimeout(roll,2000)
 &amp;lt;/script&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_gMzioD');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_gMzioD');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;hl-surround&quot;&gt;&lt;ol class=&quot;hl-main ln-show&quot; title=&quot;Double click to hide line number.&quot; ondblclick = &quot;linenumber(this)&quot;&gt;&lt;li class=&quot;hl-firstline&quot;&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;roll&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;wrap&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollTop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;++;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;$$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;box1&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;offsetHeight&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;wrap&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollTop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//尚未滚动到第二部分的顶部位置时&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;wrap&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollTop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;wrap&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;offsetHeight&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;setTimeout&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;roll&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;20&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;))&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//20毫秒即递归一次&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//当滚动的累计距离达到显示域高度的倍数时&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;setTimeout&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;roll&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;2000&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;))&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//等待2秒才递归调用&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;setTimeout&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;$$('wrap').scrollTop=0;roll()&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;2000&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;运用递归，而没有用setInterval&lt;/p&gt;


&lt;p&gt;Related posts:&lt;ol&gt;&lt;li&gt;&lt;a href='http://www.cssass.com/blog/index.php/2010/608.html' rel='bookmark' title='Permanent Link: 简单效果——滚动展示'&gt;简单效果——滚动展示&lt;/a&gt; &lt;small&gt;上回的文章里提到了文字滚屏效果。是无限滚动下去的。 现在弄一个可控制的单步滚动效果。 &amp;lt;!DOCTYPE HTML&amp;gt; &amp;lt;html &amp;gt; &amp;lt;head&amp;gt; &amp;lt;meta charset=&amp;quot;utf-8&amp;quot;&amp;gt; &amp;lt;title&amp;gt;横向滚动控制&amp;lt;/title&amp;gt;...&lt;/small&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;</content><thr:total>3</thr:total><description>&amp;#60;style&amp;#62;
	*{padding:0;margin:0;font-size:12px;}
	#wrap{width:300px;background:#eee;}
	#wrap li{height:22px;line-height:22px;}
&amp;#60;/style&amp;#62;
&amp;#60;div id=&amp;#34;wrap&amp;#34; style=&amp;#34;overflow:hidden;height:100px;&amp;#34;&amp;#62;  &amp;#60;!--  height值一定要比box1的offsetHeight(亦即box2的offsetTop)要小 --&amp;#62;
	&amp;#60;ul id=&amp;#34;box1&amp;#34;&amp;#62;
		&amp;#60;li&amp;#62;1 &amp;#60;a href=&amp;#34;#&amp;#34; title=&amp;#34;信息公开工作&amp;#34;&amp;#62;信息公开工作&amp;#60;/a&amp;#62;&amp;#60;/li&amp;#62;
		&amp;#60;li&amp;#62;2 &amp;#60;a href=&amp;#34;#&amp;#34; title=&amp;#34;信息公开工作&amp;#34;&amp;#62;国务院办公厅转发监察部等部门 &amp;#60;/a&amp;#62;&amp;#60;/li&amp;#62;
		&amp;#60;li&amp;#62;3 &amp;#60;a href=&amp;#34;#&amp;#34; title=&amp;#34;信息公开工作&amp;#34;&amp;#62;我市将严查损害发展环境问题&amp;#60;/a&amp;#62;&amp;#60;/li&amp;#62;
		&amp;#60;li&amp;#62;4 &amp;#60;a href=&amp;#34;#&amp;#34; title=&amp;#34;办公时间调整通知&amp;#34;&amp;#62;办公时间调整通知&amp;#60;/a&amp;#62;&amp;#60;/li&amp;#62;
		&amp;#60;li&amp;#62;5 &amp;#60;a href=&amp;#34;#&amp;#34; title=&amp;#34;办公时间调整通知&amp;#34;&amp;#62;办公时间调整通知d&amp;#60;/a&amp;#62;&amp;#60;/li&amp;#62;
	&amp;#60;/ul&amp;#62;
	&amp;#60;ul id=&amp;#34;box2&amp;#34;&amp;#62;&amp;#60;/ul&amp;#62;
&amp;#60;/div&amp;#62;
&amp;#60;!-- 无他，放参考值尔 --&amp;#62;
&amp;#60;div id=&amp;#34;refer&amp;#34;&amp;#62;
&amp;#60;/div&amp;#62;
&amp;#60;script type=&amp;#34;text/javascript&amp;#34;&amp;#62;
		var speed=50;
		var $$=function(id){return document.getElementById(id);}
		$$('box2').innerHTML=box1.innerHTML;
		function roll(){
			if($$('box2').offsetTop-$$('wrap').scrollTop&amp;#60;=0)  {  //当滚动到第二部分的顶部位置时
				$$('wrap').scrollTop-=$$('box1').offsetHeight;	  //重置至第一部分顶部位置,相当于$$('box').scrollTop=0;
				}
			else{
				$$('wrap').scrollTop++ ;
				$$('refer').innerHTML=$$('box2').offsetTop+' '+$$('wrap').offsetHeight+' '+$$('wrap').scrollTop  //无他，参考值尔
			}
		}
		var start=setInterval(roll,speed);
		$$('wrap').onmouseover=function() {clearInterval(start)};
		$$('wrap').onmouseout=function() {start=setInterval(roll,speed)};
&amp;#60;/script&amp;#62;

  

先看看无缝滚动的效果，使用window的setInterval方法重复调用一个滚动函数。
关键的代码是
function roll(){&amp;#160; 
&amp;#160; &amp;#160; &amp;#160; [...]


Related posts:&lt;ol&gt;&lt;li&gt;&lt;a href='http://www.cssass.com/blog/index.php/2010/608.html' rel='bookmark' title='Permanent Link: 简单效果——滚动展示'&gt;简单效果——滚动展示&lt;/a&gt; &lt;small&gt;上回的文章里提到了文字滚屏效果。是无限滚动下去的。 现在弄一个可控制的单步滚动效果。 &amp;lt;!DOCTYPE HTML&amp;gt; &amp;lt;html &amp;gt; &amp;lt;head&amp;gt; &amp;lt;meta charset=&amp;quot;utf-8&amp;quot;&amp;gt; &amp;lt;title&amp;gt;横向滚动控制&amp;lt;/title&amp;gt;...&lt;/small&gt;&lt;/li&gt;&lt;/ol&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/327288750/CSSASS/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/CSSASS/~7351173/327288750/5460608/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/CSSASS/327288750/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/CSSASS/327288750/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</description><content:encoded>&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_ADqq7x&quot;&gt;
&amp;lt;style&amp;gt;
	*{padding:0;margin:0;font-size:12px;}
	#wrap{width:300px;background:#eee;}
	#wrap li{height:22px;line-height:22px;}
&amp;lt;/style&amp;gt;
&amp;lt;div id=&amp;quot;wrap&amp;quot; style=&amp;quot;overflow:hidden;height:100px;&amp;quot;&amp;gt;  &amp;lt;!--  height值一定要比box1的offsetHeight(亦即box2的offsetTop)要小 --&amp;gt;
	&amp;lt;ul id=&amp;quot;box1&amp;quot;&amp;gt;
		&amp;lt;li&amp;gt;1 &amp;lt;a href=&amp;quot;#&amp;quot; title=&amp;quot;信息公开工作&amp;quot;&amp;gt;信息公开工作&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;2 &amp;lt;a href=&amp;quot;#&amp;quot; title=&amp;quot;信息公开工作&amp;quot;&amp;gt;国务院办公厅转发监察部等部门 &amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;3 &amp;lt;a href=&amp;quot;#&amp;quot; title=&amp;quot;信息公开工作&amp;quot;&amp;gt;我市将严查损害发展环境问题&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;4 &amp;lt;a href=&amp;quot;#&amp;quot; title=&amp;quot;办公时间调整通知&amp;quot;&amp;gt;办公时间调整通知&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;5 &amp;lt;a href=&amp;quot;#&amp;quot; title=&amp;quot;办公时间调整通知&amp;quot;&amp;gt;办公时间调整通知d&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
	&amp;lt;/ul&amp;gt;
	&amp;lt;ul id=&amp;quot;box2&amp;quot;&amp;gt;&amp;lt;/ul&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;!-- 无他，放参考值尔 --&amp;gt;
&amp;lt;div id=&amp;quot;refer&amp;quot;&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
		var speed=50;
		var $$=function(id){return document.getElementById(id);}
		$$('box2').innerHTML=box1.innerHTML;
		function roll(){
			if($$('box2').offsetTop-$$('wrap').scrollTop&amp;lt;=0)  {  //当滚动到第二部分的顶部位置时
				$$('wrap').scrollTop-=$$('box1').offsetHeight;	  //重置至第一部分顶部位置,相当于$$('box').scrollTop=0;
				}
			else{
				$$('wrap').scrollTop++ ;
				$$('refer').innerHTML=$$('box2').offsetTop+' '+$$('wrap').offsetHeight+' '+$$('wrap').scrollTop  //无他，参考值尔
			}
		}
		var start=setInterval(roll,speed);
		$$('wrap').onmouseover=function() {clearInterval(start)};
		$$('wrap').onmouseout=function() {start=setInterval(roll,speed)};
&amp;lt;/script&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_ADqq7x');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_ADqq7x');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;先看看无缝滚动的效果，使用window的setInterval方法重复调用一个滚动函数。&lt;br /&gt;
关键的代码是&lt;/p&gt;
&lt;div class=&quot;hl-surround&quot;&gt;&lt;ol class=&quot;hl-main ln-show&quot; title=&quot;Double click to hide line number.&quot; ondblclick = &quot;linenumber(this)&quot;&gt;&lt;li class=&quot;hl-firstline&quot;&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;roll&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(){&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;$$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;box2&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;offsetTop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;-$$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;wrap&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollTop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//当滚动到第二部分的顶部位置时&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;wrap&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollTop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;-=$$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;box1&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;offsetHeight&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//重置至第一部分顶部位置,相当于$$('box').scrollTop=0;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;wrap&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollTop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;++ ;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;refer&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;innerHTML&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=$$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;box2&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;offsetTop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;+$$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;wrap&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;offsetHeight&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;+$$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;wrap&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollTop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//无他，参考值尔&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Green;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;start&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;setInterval&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;roll&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;speed&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;而无缝的关键还在这里&lt;/p&gt;
&lt;div class=&quot;hl-surround&quot;&gt;&lt;ol class=&quot;hl-main ln-show&quot; title=&quot;Double click to hide line number.&quot; ondblclick = &quot;linenumber(this)&quot;&gt;&lt;li class=&quot;hl-firstline&quot;&gt;&lt;span style=&quot;color: Gray;&quot;&gt;$$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;box2&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;innerHTML&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;box1&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;innerHTML&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//拷贝一份内容跟随其后，使原内容之后还有内容&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;我原本要做的效果并非全如上面，我需要的效果是：&lt;b&gt;单条为一步阶，进行间歇性循环无缝滚动&lt;/b&gt;。&lt;/p&gt;
&lt;p&gt;其实提起滚动，应该立马会想起走马灯（marquee）。尽管对其一直有偏见，但我还是会给他个机会的。。。&lt;/p&gt;
&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_4IOmaF&quot;&gt;
&amp;lt;style&amp;gt;
	*{padding:0;margin:0;}
	#quee li{height:30px;line-height:30px;}
&amp;lt;/style&amp;gt;
&amp;lt;div style=&amp;quot;border:1px solid #ccc;&amp;quot;&amp;gt;
	&amp;lt;marquee id=&amp;quot;quee&amp;quot; direction=up scrollamount=&amp;quot;3&amp;quot;scrolldelay=&amp;quot;0&amp;quot; style=&amp;quot;height:30px;&amp;quot; &amp;gt;
	&amp;lt;ul&amp;gt;
		&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;1两会会谈在即陈云 抵台 台湾警方加强维安。(09-09:15)&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;2两会会谈在即陈云 抵台 台湾警方加强维安。(09-09:15)&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;3两会会谈在即陈云 抵台 台湾警方加强维安。(09-09:15)&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;4两会会谈在即陈云 抵台 台湾警方加强维安。(09-09:15)&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;5两会会谈在即陈云 抵台 台湾警方加强维安。(09-09:15)&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;6两会会谈在即陈云 抵台 台湾警方加强维安。(09-09:15)&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
	&amp;lt;/ul&amp;gt;
	&amp;lt;/marquee&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;!-- --&amp;gt;
&amp;lt;div id=&amp;quot;cc&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
	var $$=function(id){return document.getElementById(id);}
	var quee=document.getElementById('quee');
	setTimeout(func,1000);
	function func(){
		$$('quee').stop();
		setTimeout(func2,1000);
		$$('cc').innerHTML=$$('quee').scrollTop;  //参考值
	}
	function func2(){
		$$('quee').start();
		setTimeout(func,1000);
	}
 &amp;lt;/script&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_4IOmaF');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_4IOmaF');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;hl-surround&quot;&gt;&lt;ol class=&quot;hl-main ln-show&quot; title=&quot;Double click to hide line number.&quot; ondblclick = &quot;linenumber(this)&quot;&gt;&lt;li class=&quot;hl-firstline&quot;&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;func&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;quee&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;stop&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;setTimeout&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;func2&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;1000&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;func2&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;quee&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;start&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;setTimeout&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;func&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;1000&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;延时1秒交叉调用marquee的内置函数start()和stop();&lt;/p&gt;
&lt;p&gt;不过，scrollamount影响的步阶不准确啊，而且不能做到无缝么。好，将marquee拖出去斩了（marquee:冤枉啊~~~~~）&lt;/p&gt;
&lt;p&gt;下面是新的做法&lt;/p&gt;
&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_gMzioD&quot;&gt;
&amp;lt;style&amp;gt;
	*{padding:0;margin:0;}
	#wrap li{height:30px;line-height:30px;}
&amp;lt;/style&amp;gt;
&amp;lt;div id=&amp;quot;wrap&amp;quot; style=&amp;quot;height:30px;overflow:hidden;background:#eee&amp;quot; &amp;gt;  &amp;lt;!-- 注意这里的高度值要匹配 --&amp;gt;
	&amp;lt;ul id=&amp;quot;box1&amp;quot;&amp;gt;
		&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;1两会会谈在即陈抵台 台湾警方加强维安。(09-09:15)&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;2两会会谈在即a抵台 台湾警方加强维安。(09-09:15)&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
		&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;3两会会谈在即s抵台 台湾警方加强维安。(09-09:15)&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
	&amp;lt;/ul&amp;gt;
	&amp;lt;ul id=&amp;quot;box2&amp;quot;&amp;gt;
	&amp;lt;/ul&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;!-- --&amp;gt;
 &amp;lt;div id=&amp;quot;cc&amp;quot;&amp;gt; &amp;lt;/div&amp;gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
	var $$=function(id){return document.getElementById(id);}
	var start;
	$$('box2').innerHTML=$$('box1').innerHTML;
	function roll(){
		wrap.scrollTop++;
		$$('cc').innerHTML=wrap.scrollTop;   //无用，纯粹做参考数值
		 if($$('box1').offsetHeight-wrap.scrollTop&amp;gt;0){  //尚未滚动到第二部分的顶部位置时
			 if(wrap.scrollTop%wrap.offsetHeight!=0)  //
			 {
				return(setTimeout(roll,20));	 //20毫秒即递归一次
			 }
			 else{						//当滚动的累计距离达到显示域高度的倍数时
				return(setTimeout(roll,2000));  //等待2秒才递归调用
			 }
		 }
		 else{
				setTimeout(&amp;quot;$$('wrap').scrollTop=0;roll()&amp;quot;,2000);
			}
	}
	setTimeout(roll,2000)
 &amp;lt;/script&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_gMzioD');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_gMzioD');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;hl-surround&quot;&gt;&lt;ol class=&quot;hl-main ln-show&quot; title=&quot;Double click to hide line number.&quot; ondblclick = &quot;linenumber(this)&quot;&gt;&lt;li class=&quot;hl-firstline&quot;&gt;&lt;span style=&quot;color: Green;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;roll&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(){&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;wrap&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollTop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;++;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;$$&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;box1&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;offsetHeight&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;wrap&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollTop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;){&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//尚未滚动到第二部分的顶部位置时&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;wrap&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;scrollTop&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;wrap&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;offsetHeight&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;setTimeout&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;roll&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;20&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;))&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//20毫秒即递归一次&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//当滚动的累计距离达到显示域高度的倍数时&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;setTimeout&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;roll&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;2000&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;))&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #ffa500;&quot;&gt;//等待2秒才递归调用&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Green;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Blue;&quot;&gt;setTimeout&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: Red;&quot;&gt;$$('wrap').scrollTop=0;roll()&lt;/span&gt;&lt;span style=&quot;color: #8b0000;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: Maroon;&quot;&gt;2000&lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: Gray;&quot;&gt;;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: Gray;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: Olive;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;运用递归，而没有用setInterval&lt;/p&gt;


&lt;p&gt;Related posts:&lt;ol&gt;&lt;li&gt;&lt;a href='http://www.cssass.com/blog/index.php/2010/608.html' rel='bookmark' title='Permanent Link: 简单效果——滚动展示'&gt;简单效果——滚动展示&lt;/a&gt; &lt;small&gt;上回的文章里提到了文字滚屏效果。是无限滚动下去的。 现在弄一个可控制的单步滚动效果。 &amp;lt;!DOCTYPE HTML&amp;gt; &amp;lt;html &amp;gt; &amp;lt;head&amp;gt; &amp;lt;meta charset=&amp;quot;utf-8&amp;quot;&amp;gt; &amp;lt;title&amp;gt;横向滚动控制&amp;lt;/title&amp;gt;...&lt;/small&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/327288750/CSSASS/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/CSSASS/~7351173/327288750/5460608/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/CSSASS/327288750/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/CSSASS/327288750/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><category domain="http://www.cssass.com/blog">javascript</category><category domain="http://www.cssass.com/blog">marquee</category><category domain="http://www.cssass.com/blog">setInterval</category><category domain="http://www.cssass.com/blog">无缝滚动</category><category domain="http://www.cssass.com/blog">递归</category><pubDate>Mon, 25 Jan 2010 21:10:17 +0800</pubDate><guid isPermaLink="false">http://www.cssass.com/blog/?p=547</guid><dc:creator>ONEBOYS</dc:creator><fs:srclink>http://www.cssass.com/blog/index.php/2009/547.html</fs:srclink><fs:srcfeed>http://www.cssass.com/blog/index.php/feed/atom</fs:srcfeed><fs:itemid>feedsky/CSSASS/~7351173/327288750/5460608</fs:itemid></item><item><title>浅谈辄止：line-height和vertical-align</title><link atom:type="text/html">http://item.feedsky.com/~feedsky/CSSASS/~7351173/327288749/5460608/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>ONEBOYS</name><uri>http://www.cssass.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://www.cssass.com/blog/?p=490</id><content xmlns="http://www.w3.org/2005/Atom" type="html" xml:base="http://www.cssass.com/blog/index.php/2010/490.html">&lt;p&gt;line-height可以应用在所有元素上。&lt;br /&gt;
但尽管line-height可以加在block元素上，实际起作用的却是内部的inline元素或textnode节点。&lt;/p&gt;
&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_WtBFv_&quot;&gt;
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta charset=&amp;quot;utf-8&amp;quot; /&amp;gt;
&amp;lt;title&amp;gt;line-height对非可置换inline元素的影响&amp;lt;/title&amp;gt;
&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
.box{border:1px solid #000}
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
	&amp;lt;div class=&amp;quot;box&amp;quot; style=&amp;quot;line-height:100px&amp;quot;&amp;gt;
		&amp;lt;span&amp;gt;line-height加在外层div上&amp;lt;/span&amp;gt;
	&amp;lt;/div&amp;gt;
	&amp;lt;div class=&amp;quot;box&amp;quot; &amp;gt;
		&amp;lt;span style=&amp;quot;line-height:100px&amp;quot;&amp;gt;line-height加在内层span上&amp;lt;/span&amp;gt;
	&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_WtBFv_');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_WtBFv_');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;另外，line-height属性可继承。&lt;/p&gt;
&lt;p&gt;非可置换inline元素没有height;每一行的高度就由line-height决定。&lt;br /&gt;
而对于可置换inline元素，他本身其实是有内在高度的，将不受line-height影响（ie7是个例外）。&lt;/p&gt;
&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_kii3Sa&quot;&gt;
&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&amp;gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=utf-8&amp;quot; /&amp;gt;
&amp;lt;title&amp;gt;可置换inline元素&amp;lt;/title&amp;gt;
&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
.box{border:1px solid #000}
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
	&amp;lt;div class=&amp;quot;box&amp;quot; style=&amp;quot;line-height:100px&amp;quot;&amp;gt;
		&amp;lt;input type=&amp;quot;text&amp;quot;  /&amp;gt;
	&amp;lt;/div&amp;gt;
	&amp;lt;div class=&amp;quot;box&amp;quot; style=&amp;quot;line-height:100px&amp;quot;&amp;gt;
		&amp;lt;input type=&amp;quot;text&amp;quot; /&amp;gt;若有textNode文本,又另当别论。
	&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_kii3Sa');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_kii3Sa');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;但这点性质，似乎正在改变。&lt;br /&gt;
css2.1也如是说：对于block,inline-block(可置换inline元素就是天生的inline-block元素), line-height是做为其minimal height的。那当高度小于line-height时，是理应起作用的。&lt;br /&gt;
我们使用html5的doctype声明:&lt;/p&gt;
&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_l0IJ7q&quot;&gt;
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta charset=&amp;quot;utf-8&amp;quot; /&amp;gt;
&amp;lt;title&amp;gt;可置换inline元素&amp;lt;/title&amp;gt;
&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
.box{border:1px solid #000}
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
	&amp;lt;div class=&amp;quot;box&amp;quot; style=&amp;quot;line-height:100px&amp;quot;&amp;gt;
		&amp;lt;input type=&amp;quot;text&amp;quot; /&amp;gt;
	&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_l0IJ7q');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_l0IJ7q');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;在上面的例子里，除了ie6，这里的line-height在其他浏览器都能起作用。&lt;br /&gt;
总之，&lt;b&gt;单纯设置外层height=line-height使image等可置换元素垂直居中，在ie6下是行不通的&lt;/b&gt;——如果要考虑ie6，请记住这一点。&lt;br /&gt;
那么，如何才能做到inline元素(包括可置换inline元素)的垂直居中，并且推而广之应用在block元素上呢？我们可以利用vertical-align属性。&lt;/p&gt;
&lt;p&gt;现在先摘要说下vertical-align属性。&lt;br /&gt;
在CSS Specification中，line-height属性和vertical-align属性就是放在一起做介绍的。&lt;br /&gt;
&lt;a href=&quot;http://www.w3.org/TR/CSS2/visudet.html#line-height&quot; target=&quot;_blank&quot;&gt;Line height calculations: the &amp;#8216;line-height&amp;#8217; and &amp;#8216;vertical-align&amp;#8217; properties&lt;br /&gt;
&lt;/a&gt;&lt;br /&gt;
vertical-align的默认值是baseline;&lt;br /&gt;
与line-height不同，&lt;b&gt;vertical-align只能用在inline元素（还有&amp;#8217;table-cell&amp;#8217; 元素）上&lt;/b&gt;&lt;br /&gt;
vertical-align属性在各个浏览器下都有不少的差异。参见：&lt;a href=&quot;http://www.mikkolee.com/13&quot; target=&quot;_blank&quot;&gt;http://www.mikkolee.com/13&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;不过，我们要用到的属性middle在各个浏览器解释中却没有什么差异（或只有微小的差异）。&lt;br /&gt;
让同行的inline元素按中间线对齐，我们给各个inline元素加上vertical-align:middle;&lt;/p&gt;
&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_VRCr7f&quot;&gt;
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta  charset=&amp;quot;utf-8&amp;quot; /&amp;gt;
&amp;lt;title&amp;gt;横向对齐&amp;lt;/title&amp;gt;
&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
.box{height:100px;border:1px solid #000;}
.box input,.box span{vertical-align:middle;}
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;
	vertical-align:middle&amp;lt;input type=&amp;quot;text&amp;quot; style=&amp;quot;padding:10px;&amp;quot; /&amp;gt;&amp;lt;span&amp;gt;各元素横行对齐&amp;lt;/span&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_VRCr7f');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_VRCr7f');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;接着我们要相对外层做垂直居中。&lt;br /&gt;
假如，内部的一个inline元素（当然是可置换inline元素,或是设置了inline-block的元素——这二者其实是一样的）的高度也达到外层的高度，那么就可以保证内层所有的inline元素都垂直居中了。&lt;br /&gt;
所以我们可以设置这样一个空元素pillar。&lt;/p&gt;
&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_ksYOhs&quot;&gt;
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta  charset=&amp;quot;utf-8&amp;quot; /&amp;gt;
&amp;lt;title&amp;gt;横向对齐&amp;lt;/title&amp;gt;
&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
.box{height:100px;border:1px solid #000;}
.box input,.box span{vertical-align:middle;}
.pillar{display:inline-block;width:0px;height:100%;vertical-align:middle;}  /* width:0的话，在opera下会失效。当然也有另外的方法来解决opera */
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;
	&amp;lt;span class=&amp;quot;pillar&amp;quot; &amp;gt;&amp;lt;/span&amp;gt;vertical-align:middle&amp;lt;input type=&amp;quot;text&amp;quot; style=&amp;quot;padding:10px;&amp;quot; /&amp;gt;&amp;lt;span&amp;gt;各元素横行对齐&amp;lt;/span&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_ksYOhs');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_ksYOhs');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;是不是很熟悉啊，我们“未知尺寸元素的垂直居中”的一个方法就是从这里衍生而来的——那是针对block元素的居中：&lt;a href=&quot;http://www.cssass.com/blog/index.php/2008/36.html&quot; target=&quot;_blank&quot;&gt;http://www.cssass.com/blog/index.php/2008/36.html&lt;/a&gt;&lt;br /&gt;
做法就是将block元素变成inline-block,或者干脆使用某一inline元素包住block元素（尽管这不符合标准），然后再使用上面的方法。&lt;/p&gt;


&lt;p&gt;Related posts:&lt;ol&gt;&lt;li&gt;&lt;a href='http://www.cssass.com/blog/index.php/2008/36.html' rel='bookmark' title='Permanent Link: 改变元素display属性的垂直居中方法。'&gt;改变元素display属性的垂直居中方法。&lt;/a&gt; &lt;small&gt;之前也有搜集过纯CSS的几种方法。 但觉得没有下面的好。 &amp;lt;!DOCTYPE HTML&amp;gt; &amp;lt;html&amp;gt; &amp;lt;head&amp;gt; &amp;lt;meta charset=&amp;quot;utf-8&amp;quot; /&amp;gt; &amp;lt;style...&lt;/small&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;</content><thr:total>7</thr:total><description>line-height可以应用在所有元素上。
但尽管line-height可以加在block元素上，实际起作用的却是内部的inline元素或textnode节点。


&amp;#60;!DOCTYPE html&amp;#62;
&amp;#60;html&amp;#62;
&amp;#60;head&amp;#62;
&amp;#60;meta charset=&amp;#34;utf-8&amp;#34; /&amp;#62;
&amp;#60;title&amp;#62;line-height对非可置换inline元素的影响&amp;#60;/title&amp;#62;
&amp;#60;style type=&amp;#34;text/css&amp;#34;&amp;#62;
.box{border:1px solid #000}
&amp;#60;/style&amp;#62;
&amp;#60;/head&amp;#62;
&amp;#60;body&amp;#62;
	&amp;#60;div class=&amp;#34;box&amp;#34; style=&amp;#34;line-height:100px&amp;#34;&amp;#62;
		&amp;#60;span&amp;#62;line-height加在外层div上&amp;#60;/span&amp;#62;
	&amp;#60;/div&amp;#62;
	&amp;#60;div class=&amp;#34;box&amp;#34; &amp;#62;
		&amp;#60;span style=&amp;#34;line-height:100px&amp;#34;&amp;#62;line-height加在内层span上&amp;#60;/span&amp;#62;
	&amp;#60;/div&amp;#62;
&amp;#60;/body&amp;#62;
&amp;#60;/html&amp;#62;

  

另外，line-height属性可继承。
非可置换inline元素没有height;每一行的高度就由line-height决定。
而对于可置换inline元素，他本身其实是有内在高度的，将不受line-height影响（ie7是个例外）。


&amp;#60;!DOCTYPE html PUBLIC &amp;#34;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;#34; &amp;#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;#34;&amp;#62;
&amp;#60;html xmlns=&amp;#34;http://www.w3.org/1999/xhtml&amp;#34;&amp;#62;
&amp;#60;head&amp;#62;
&amp;#60;meta http-equiv=&amp;#34;Content-Type&amp;#34; content=&amp;#34;text/html; charset=utf-8&amp;#34; /&amp;#62;
&amp;#60;title&amp;#62;可置换inline元素&amp;#60;/title&amp;#62;
&amp;#60;style type=&amp;#34;text/css&amp;#34;&amp;#62;
.box{border:1px solid #000}
&amp;#60;/style&amp;#62;
&amp;#60;/head&amp;#62;
&amp;#60;body&amp;#62;
	&amp;#60;div class=&amp;#34;box&amp;#34; style=&amp;#34;line-height:100px&amp;#34;&amp;#62;
		&amp;#60;input type=&amp;#34;text&amp;#34;  /&amp;#62;
	&amp;#60;/div&amp;#62;
	&amp;#60;div class=&amp;#34;box&amp;#34; style=&amp;#34;line-height:100px&amp;#34;&amp;#62;
		&amp;#60;input type=&amp;#34;text&amp;#34; /&amp;#62;若有textNode文本,又另当别论。
	&amp;#60;/div&amp;#62;
&amp;#60;/body&amp;#62;
&amp;#60;/html&amp;#62;

  

但这点性质，似乎正在改变。
css2.1也如是说：对于block,inline-block(可置换inline元素就是天生的inline-block元素), line-height是做为其minimal height的。那当高度小于line-height时，是理应起作用的。
我们使用html5的doctype声明:


&amp;#60;!DOCTYPE html&amp;#62;
&amp;#60;html&amp;#62;
&amp;#60;head&amp;#62;
&amp;#60;meta charset=&amp;#34;utf-8&amp;#34; /&amp;#62;
&amp;#60;title&amp;#62;可置换inline元素&amp;#60;/title&amp;#62;
&amp;#60;style type=&amp;#34;text/css&amp;#34;&amp;#62;
.box{border:1px solid #000}
&amp;#60;/style&amp;#62;
&amp;#60;/head&amp;#62;
&amp;#60;body&amp;#62;
	&amp;#60;div class=&amp;#34;box&amp;#34; style=&amp;#34;line-height:100px&amp;#34;&amp;#62;
		&amp;#60;input type=&amp;#34;text&amp;#34; /&amp;#62;
	&amp;#60;/div&amp;#62;
&amp;#60;/body&amp;#62;
&amp;#60;/html&amp;#62;

  

在上面的例子里，除了ie6，这里的line-height在其他浏览器都能起作用。
总之，单纯设置外层height=line-height使image等可置换元素垂直居中，在ie6下是行不通的——如果要考虑ie6，请记住这一点。
那么，如何才能做到inline元素(包括可置换inline元素)的垂直居中，并且推而广之应用在block元素上呢？我们可以利用vertical-align属性。
现在先摘要说下vertical-align属性。
在CSS Specification中，line-height属性和vertical-align属性就是放在一起做介绍的。
Line [...]


Related posts:&lt;ol&gt;&lt;li&gt;&lt;a href='http://www.cssass.com/blog/index.php/2008/36.html' rel='bookmark' title='Permanent Link: 改变元素display属性的垂直居中方法。'&gt;改变元素display属性的垂直居中方法。&lt;/a&gt; &lt;small&gt;之前也有搜集过纯CSS的几种方法。 但觉得没有下面的好。 &amp;lt;!DOCTYPE HTML&amp;gt; &amp;lt;html&amp;gt; &amp;lt;head&amp;gt; &amp;lt;meta charset=&amp;quot;utf-8&amp;quot; /&amp;gt; &amp;lt;style...&lt;/small&gt;&lt;/li&gt;&lt;/ol&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/327288749/CSSASS/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/CSSASS/~7351173/327288749/5460608/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/CSSASS/327288749/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/CSSASS/327288749/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</description><content:encoded>&lt;p&gt;line-height可以应用在所有元素上。&lt;br /&gt;
但尽管line-height可以加在block元素上，实际起作用的却是内部的inline元素或textnode节点。&lt;/p&gt;
&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_WtBFv_&quot;&gt;
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta charset=&amp;quot;utf-8&amp;quot; /&amp;gt;
&amp;lt;title&amp;gt;line-height对非可置换inline元素的影响&amp;lt;/title&amp;gt;
&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
.box{border:1px solid #000}
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
	&amp;lt;div class=&amp;quot;box&amp;quot; style=&amp;quot;line-height:100px&amp;quot;&amp;gt;
		&amp;lt;span&amp;gt;line-height加在外层div上&amp;lt;/span&amp;gt;
	&amp;lt;/div&amp;gt;
	&amp;lt;div class=&amp;quot;box&amp;quot; &amp;gt;
		&amp;lt;span style=&amp;quot;line-height:100px&amp;quot;&amp;gt;line-height加在内层span上&amp;lt;/span&amp;gt;
	&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_WtBFv_');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_WtBFv_');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;另外，line-height属性可继承。&lt;/p&gt;
&lt;p&gt;非可置换inline元素没有height;每一行的高度就由line-height决定。&lt;br /&gt;
而对于可置换inline元素，他本身其实是有内在高度的，将不受line-height影响（ie7是个例外）。&lt;/p&gt;
&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_kii3Sa&quot;&gt;
&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&amp;gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=utf-8&amp;quot; /&amp;gt;
&amp;lt;title&amp;gt;可置换inline元素&amp;lt;/title&amp;gt;
&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
.box{border:1px solid #000}
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
	&amp;lt;div class=&amp;quot;box&amp;quot; style=&amp;quot;line-height:100px&amp;quot;&amp;gt;
		&amp;lt;input type=&amp;quot;text&amp;quot;  /&amp;gt;
	&amp;lt;/div&amp;gt;
	&amp;lt;div class=&amp;quot;box&amp;quot; style=&amp;quot;line-height:100px&amp;quot;&amp;gt;
		&amp;lt;input type=&amp;quot;text&amp;quot; /&amp;gt;若有textNode文本,又另当别论。
	&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_kii3Sa');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_kii3Sa');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;但这点性质，似乎正在改变。&lt;br /&gt;
css2.1也如是说：对于block,inline-block(可置换inline元素就是天生的inline-block元素), line-height是做为其minimal height的。那当高度小于line-height时，是理应起作用的。&lt;br /&gt;
我们使用html5的doctype声明:&lt;/p&gt;
&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_l0IJ7q&quot;&gt;
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta charset=&amp;quot;utf-8&amp;quot; /&amp;gt;
&amp;lt;title&amp;gt;可置换inline元素&amp;lt;/title&amp;gt;
&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
.box{border:1px solid #000}
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
	&amp;lt;div class=&amp;quot;box&amp;quot; style=&amp;quot;line-height:100px&amp;quot;&amp;gt;
		&amp;lt;input type=&amp;quot;text&amp;quot; /&amp;gt;
	&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_l0IJ7q');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_l0IJ7q');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;在上面的例子里，除了ie6，这里的line-height在其他浏览器都能起作用。&lt;br /&gt;
总之，&lt;b&gt;单纯设置外层height=line-height使image等可置换元素垂直居中，在ie6下是行不通的&lt;/b&gt;——如果要考虑ie6，请记住这一点。&lt;br /&gt;
那么，如何才能做到inline元素(包括可置换inline元素)的垂直居中，并且推而广之应用在block元素上呢？我们可以利用vertical-align属性。&lt;/p&gt;
&lt;p&gt;现在先摘要说下vertical-align属性。&lt;br /&gt;
在CSS Specification中，line-height属性和vertical-align属性就是放在一起做介绍的。&lt;br /&gt;
&lt;a href=&quot;http://www.w3.org/TR/CSS2/visudet.html#line-height&quot; target=&quot;_blank&quot;&gt;Line height calculations: the &amp;#8216;line-height&amp;#8217; and &amp;#8216;vertical-align&amp;#8217; properties&lt;br /&gt;
&lt;/a&gt;&lt;br /&gt;
vertical-align的默认值是baseline;&lt;br /&gt;
与line-height不同，&lt;b&gt;vertical-align只能用在inline元素（还有&amp;#8217;table-cell&amp;#8217; 元素）上&lt;/b&gt;&lt;br /&gt;
vertical-align属性在各个浏览器下都有不少的差异。参见：&lt;a href=&quot;http://www.mikkolee.com/13&quot; target=&quot;_blank&quot;&gt;http://www.mikkolee.com/13&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;不过，我们要用到的属性middle在各个浏览器解释中却没有什么差异（或只有微小的差异）。&lt;br /&gt;
让同行的inline元素按中间线对齐，我们给各个inline元素加上vertical-align:middle;&lt;/p&gt;
&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_VRCr7f&quot;&gt;
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta  charset=&amp;quot;utf-8&amp;quot; /&amp;gt;
&amp;lt;title&amp;gt;横向对齐&amp;lt;/title&amp;gt;
&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
.box{height:100px;border:1px solid #000;}
.box input,.box span{vertical-align:middle;}
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;
	vertical-align:middle&amp;lt;input type=&amp;quot;text&amp;quot; style=&amp;quot;padding:10px;&amp;quot; /&amp;gt;&amp;lt;span&amp;gt;各元素横行对齐&amp;lt;/span&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_VRCr7f');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_VRCr7f');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;接着我们要相对外层做垂直居中。&lt;br /&gt;
假如，内部的一个inline元素（当然是可置换inline元素,或是设置了inline-block的元素——这二者其实是一样的）的高度也达到外层的高度，那么就可以保证内层所有的inline元素都垂直居中了。&lt;br /&gt;
所以我们可以设置这样一个空元素pillar。&lt;/p&gt;
&lt;div class=&quot;runcode&quot;&gt;
&lt;p&gt;&lt;textarea name=&quot;runcode&quot; class=&quot;runcode_text&quot; id=&quot;runcode_ksYOhs&quot;&gt;
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta  charset=&amp;quot;utf-8&amp;quot; /&amp;gt;
&amp;lt;title&amp;gt;横向对齐&amp;lt;/title&amp;gt;
&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
.box{height:100px;border:1px solid #000;}
.box input,.box span{vertical-align:middle;}
.pillar{display:inline-block;width:0px;height:100%;vertical-align:middle;}  /* width:0的话，在opera下会失效。当然也有另外的方法来解决opera */
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;div class=&amp;quot;box&amp;quot;&amp;gt;
	&amp;lt;span class=&amp;quot;pillar&amp;quot; &amp;gt;&amp;lt;/span&amp;gt;vertical-align:middle&amp;lt;input type=&amp;quot;text&amp;quot; style=&amp;quot;padding:10px;&amp;quot; /&amp;gt;&amp;lt;span&amp;gt;各元素横行对齐&amp;lt;/span&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;button&quot; value=&quot;运行&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_open_new('runcode_ksYOhs');&quot;/&gt; &lt;input type=&quot;button&quot; value=&quot;复制&quot; class=&quot;runcode_button&quot; onclick=&quot;runcode_copy('runcode_ksYOhs');&quot;/&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;是不是很熟悉啊，我们“未知尺寸元素的垂直居中”的一个方法就是从这里衍生而来的——那是针对block元素的居中：&lt;a href=&quot;http://www.cssass.com/blog/index.php/2008/36.html&quot; target=&quot;_blank&quot;&gt;http://www.cssass.com/blog/index.php/2008/36.html&lt;/a&gt;&lt;br /&gt;
做法就是将block元素变成inline-block,或者干脆使用某一inline元素包住block元素（尽管这不符合标准），然后再使用上面的方法。&lt;/p&gt;


&lt;p&gt;Related posts:&lt;ol&gt;&lt;li&gt;&lt;a href='http://www.cssass.com/blog/index.php/2008/36.html' rel='bookmark' title='Permanent Link: 改变元素display属性的垂直居中方法。'&gt;改变元素display属性的垂直居中方法。&lt;/a&gt; &lt;small&gt;之前也有搜集过纯CSS的几种方法。 但觉得没有下面的好。 &amp;lt;!DOCTYPE HTML&amp;gt; &amp;lt;html&amp;gt; &amp;lt;head&amp;gt; &amp;lt;meta charset=&amp;quot;utf-8&amp;quot; /&amp;gt; &amp;lt;style...&lt;/small&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/327288749/CSSASS/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/CSSASS/~7351173/327288749/5460608/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/CSSASS/327288749/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/CSSASS/327288749/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><category domain="http://www.cssass.com/blog">CSS</category><category domain="http://www.cssass.com/blog">line-height</category><category domain="http://www.cssass.com/blog">Replaced inline</category><category domain="http://www.cssass.com/blog">vertical-align</category><category domain="http://www.cssass.com/blog">垂直居中</category><category domain="http://www.cssass.com/blog">水平对齐</category><pubDate>Tue, 19 Jan 2010 21:23:49 +0800</pubDate><guid isPermaLink="false">http://www.cssass.com/blog/?p=490</guid><dc:creator>ONEBOYS</dc:creator><fs:srclink>http://www.cssass.com/blog/index.php/2010/490.html</fs:srclink><fs:srcfeed>http://www.cssass.com/blog/index.php/feed/atom</fs:srcfeed><fs:itemid>feedsky/CSSASS/~7351173/327288749/5460608</fs:itemid></item><item><title>通灵谬言，未满25岁者必看。教训啊</title><link atom:type="text/html">http://item.feedsky.com/~feedsky/CSSASS/~7351173/327288748/5460608/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>ONEBOYS</name><uri>http://www.cssass.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://www.cssass.com/blog/?p=591</id><content xmlns="http://www.w3.org/2005/Atom" type="html" xml:base="http://www.cssass.com/blog/index.php/2010/591.html">&lt;p&gt;    余年已二十有五，逾月即将本命之年。所叹者红颜未得，知己难求，东隅已逝，宏图空有。&lt;br /&gt;
   近日得闻“《资治通鉴.梁纪》（第二十卷）有记——‘凤历五年，时洛隐者为帝卜之，曰逾二十五年未房者通灵’”。初想以身试法，一探通灵之境。然查阅《资治通鉴》，竟现谬误有三：&lt;br /&gt;
   一谬于《资治通鉴》卷二十实为《汉纪》，卷一四五至卷一六零乃为《梁纪》，而凤历年只记于《后梁纪》卷二六八，前后梁全无干系。以谬加谬，盖为始作俑者故意为之。&lt;br /&gt;
   二谬于凤历始于癸酉年（913年）正月甲子，废于当年二月庚寅。废立之间不足两月，“凤历五年”何从谈起？&lt;br /&gt;
   三谬于郢王朱友圭杀父篡位之辈，荒淫无能之徒，根基不固，乾坤难控，篡居帝位未有一年即告覆灭，身死名废，被贬庶人。因而后史记之皆呼“郢王”，而不称之为“帝”。“为帝卜之”实乃大谬。&lt;br /&gt;
   其实伪作史料者，应深知后梁历史，比如凤历之年，梁国都确在洛阳，“洛隐者为帝卜之”并不违地域常理。其他谬言，当其故意为之，一来令甄别者扑朔难查，二来盖其不敢篡改历史，故设之以馄饨虚空之年代人物，然后编造以事件。&lt;br /&gt;
  网络之内信息庞杂，真假共存。吾人当自有判断，绝不可轻信谬论，倘若贻误终身，悔之晚矣。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;http://www.b6t6.com/Article/upload/200803/080313082034151.jpg&quot; /&gt;&lt;br /&gt;
尽管我觉得吧，通灵王魔法使之类的东西肯定是假的，但网球王子里海棠熏的snake回球，修炼的好的话，绝对是能打出来的。&lt;/p&gt;


&lt;p&gt;No related posts.&lt;/p&gt;</content><thr:total>1</thr:total><description>余年已二十有五，逾月即将本命之年。所叹者红颜未得，知己难求，东隅已逝，宏图空有。
   近日得闻“《资治通鉴.梁纪》（第二十卷）有记——‘凤历五年，时洛隐者为帝卜之，曰逾二十五年未房者通灵’”。初想以身试法，一探通灵之境。然查阅《资治通鉴》，竟现谬误有三：
   一谬于《资治通鉴》卷二十实为《汉纪》，卷一四五至卷一六零乃为《梁纪》，而凤历年只记于《后梁纪》卷二六八，前后梁全无干系。以谬加谬，盖为始作俑者故意为之。
   二谬于凤历始于癸酉年（913年）正月甲子，废于当年二月庚寅。废立之间不足两月，“凤历五年”何从谈起？
   三谬于郢王朱友圭杀父篡位之辈，荒淫无能之徒，根基不固，乾坤难控，篡居帝位未有一年即告覆灭，身死名废，被贬庶人。因而后史记之皆呼“郢王”，而不称之为“帝”。“为帝卜之”实乃大谬。
   其实伪作史料者，应深知后梁历史，比如凤历之年，梁国都确在洛阳，“洛隐者为帝卜之”并不违地域常理。其他谬言，当其故意为之，一来令甄别者扑朔难查，二来盖其不敢篡改历史，故设之以馄饨虚空之年代人物，然后编造以事件。
  网络之内信息庞杂，真假共存。吾人当自有判断，绝不可轻信谬论，倘若贻误终身，悔之晚矣。

尽管我觉得吧，通灵王魔法使之类的东西肯定是假的，但网球王子里海棠熏的snake回球，修炼的好的话，绝对是能打出来的。


No related posts.


No related posts.&lt;img src=&quot;http://www1.feedsky.com/t1/327288748/CSSASS/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/CSSASS/~7351173/327288748/5460608/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/CSSASS/327288748/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/CSSASS/327288748/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</description><content:encoded>&lt;p&gt;    余年已二十有五，逾月即将本命之年。所叹者红颜未得，知己难求，东隅已逝，宏图空有。&lt;br /&gt;
   近日得闻“《资治通鉴.梁纪》（第二十卷）有记——‘凤历五年，时洛隐者为帝卜之，曰逾二十五年未房者通灵’”。初想以身试法，一探通灵之境。然查阅《资治通鉴》，竟现谬误有三：&lt;br /&gt;
   一谬于《资治通鉴》卷二十实为《汉纪》，卷一四五至卷一六零乃为《梁纪》，而凤历年只记于《后梁纪》卷二六八，前后梁全无干系。以谬加谬，盖为始作俑者故意为之。&lt;br /&gt;
   二谬于凤历始于癸酉年（913年）正月甲子，废于当年二月庚寅。废立之间不足两月，“凤历五年”何从谈起？&lt;br /&gt;
   三谬于郢王朱友圭杀父篡位之辈，荒淫无能之徒，根基不固，乾坤难控，篡居帝位未有一年即告覆灭，身死名废，被贬庶人。因而后史记之皆呼“郢王”，而不称之为“帝”。“为帝卜之”实乃大谬。&lt;br /&gt;
   其实伪作史料者，应深知后梁历史，比如凤历之年，梁国都确在洛阳，“洛隐者为帝卜之”并不违地域常理。其他谬言，当其故意为之，一来令甄别者扑朔难查，二来盖其不敢篡改历史，故设之以馄饨虚空之年代人物，然后编造以事件。&lt;br /&gt;
  网络之内信息庞杂，真假共存。吾人当自有判断，绝不可轻信谬论，倘若贻误终身，悔之晚矣。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;http://www.b6t6.com/Article/upload/200803/080313082034151.jpg&quot; /&gt;&lt;br /&gt;
尽管我觉得吧，通灵王魔法使之类的东西肯定是假的，但网球王子里海棠熏的snake回球，修炼的好的话，绝对是能打出来的。&lt;/p&gt;


&lt;p&gt;No related posts.&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/327288748/CSSASS/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/CSSASS/~7351173/327288748/5460608/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/CSSASS/327288748/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/CSSASS/327288748/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><category domain="http://www.cssass.com/blog">咬文嚼字</category><category domain="http://www.cssass.com/blog">未分类</category><category domain="http://www.cssass.com/blog">joke</category><category domain="http://www.cssass.com/blog">历史</category><pubDate>Sun, 17 Jan 2010 21:30:40 +0800</pubDate><guid isPermaLink="false">http://www.cssass.com/blog/?p=591</guid><dc:creator>ONEBOYS</dc:creator><fs:srclink>http://www.cssass.com/blog/index.php/2010/591.html</fs:srclink><fs:srcfeed>http://www.cssass.com/blog/index.php/feed/atom</fs:srcfeed><fs:itemid>feedsky/CSSASS/~7351173/327288748/5460608</fs:itemid></item><item><title>D2之行照片</title><link atom:type="text/html">http://item.feedsky.com/~feedsky/CSSASS/~7351173/327288751/5460608/1/item.html</link><author xmlns="http://www.w3.org/2005/Atom"><name>ONEBOYS</name><uri>http://www.cssass.com</uri></author><id xmlns="http://www.w3.org/2005/Atom">http://www.cssass.com/blog/?p=542</id><content xmlns="http://www.w3.org/2005/Atom" type="html" xml:base="http://www.cssass.com/blog/index.php/2009/542.html">&lt;p&gt;&lt;embed type=&quot;application/x-shockwave-flash&quot; src=&quot;http://www.bababian.com/pageshow.swf?uid=&amp;amp;sid=49B4E314A69D3AA13BC4ECE7B750C2C2DS&amp;amp;gid=&amp;amp;tags=&quot; width=&quot;600&quot;  height=&quot;510&quot; wmode=&quot;Opaque&quot;  pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot;&gt;&lt;/embed&gt;&lt;br /&gt;
为了不妨碍会场，没有开闪光灯。同时没有好的摄影技术及机器，拍的很烂，也不敢多拍。大家能看一眼真是赏光了。&lt;/p&gt;
&lt;p&gt;D2会议在人间网的即时讨论帖：&lt;a href=&quot;http://renjian.com/home?url=http%3A%2F%2Frenjian.com%2Fdd%2Fconversation%3Fid%3D310317%26page%3D4&quot; target=&quot;_blank&quot;&gt;D2人间现场直播记录&lt;/a&gt;&lt;br /&gt;
如果你还没有人间账户，可以接受我的邀请：&lt;a href=&quot;http://renjian.com/dd/reg?verify_code=VnyqWVP8HuvchiIi3J0l&quot;&gt;http://renjian.com/dd/reg?verify_code=VnyqWVP8HuvchiIi3J0l&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;D2的PPT下载及更多现场照片：&lt;a href=&quot;http://www.d2forum.org/2009/12/23/look-back-upon-the-fourth-d2-forum/&quot;&gt;http://www.d2forum.org/2009/12/23/look-back-upon-the-fourth-d2-forum/&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;No related posts.&lt;/p&gt;</content><thr:total>1</thr:total><description>为了不妨碍会场，没有开闪光灯。同时没有好的摄影技术及机器，拍的很烂，也不敢多拍。大家能看一眼真是赏光了。
D2会议在人间网的即时讨论帖：D2人间现场直播记录
如果你还没有人间账户，可以接受我的邀请：http://renjian.com/dd/reg?verify_code=VnyqWVP8HuvchiIi3J0l
D2的PPT下载及更多现场照片：http://www.d2forum.org/2009/12/23/look-back-upon-the-fourth-d2-forum/


No related posts.


No related posts.&lt;img src=&quot;http://www1.feedsky.com/t1/327288751/CSSASS/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/CSSASS/~7351173/327288751/5460608/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/CSSASS/327288751/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/CSSASS/327288751/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</description><content:encoded>&lt;p&gt;&lt;embed type=&quot;application/x-shockwave-flash&quot; src=&quot;http://www.bababian.com/pageshow.swf?uid=&amp;amp;sid=49B4E314A69D3AA13BC4ECE7B750C2C2DS&amp;amp;gid=&amp;amp;tags=&quot; width=&quot;600&quot;  height=&quot;510&quot; wmode=&quot;Opaque&quot;  pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot;&gt;&lt;/embed&gt;&lt;br /&gt;
为了不妨碍会场，没有开闪光灯。同时没有好的摄影技术及机器，拍的很烂，也不敢多拍。大家能看一眼真是赏光了。&lt;/p&gt;
&lt;p&gt;D2会议在人间网的即时讨论帖：&lt;a href=&quot;http://renjian.com/home?url=http%3A%2F%2Frenjian.com%2Fdd%2Fconversation%3Fid%3D310317%26page%3D4&quot; target=&quot;_blank&quot;&gt;D2人间现场直播记录&lt;/a&gt;&lt;br /&gt;
如果你还没有人间账户，可以接受我的邀请：&lt;a href=&quot;http://renjian.com/dd/reg?verify_code=VnyqWVP8HuvchiIi3J0l&quot;&gt;http://renjian.com/dd/reg?verify_code=VnyqWVP8HuvchiIi3J0l&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;D2的PPT下载及更多现场照片：&lt;a href=&quot;http://www.d2forum.org/2009/12/23/look-back-upon-the-fourth-d2-forum/&quot;&gt;http://www.d2forum.org/2009/12/23/look-back-upon-the-fourth-d2-forum/&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;No related posts.&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/327288751/CSSASS/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/CSSASS/~7351173/327288751/5460608/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/CSSASS/327288751/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/CSSASS/327288751/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><category domain="http://www.cssass.com/blog">未分类</category><category domain="http://www.cssass.com/blog">D2</category><category domain="http://www.cssass.com/blog">web前端</category><pubDate>Wed, 23 Dec 2009 14:53:38 +0800</pubDate><guid isPermaLink="false">http://www.cssass.com/blog/?p=542</guid><dc:creator>ONEBOYS</dc:creator><fs:srclink>http://www.cssass.com/blog/index.php/2009/542.html</fs:srclink><fs:srcfeed>http://www.cssass.com/blog/index.php/feed/atom</fs:srcfeed><fs:itemid>feedsky/CSSASS/~7351173/327288751/5460608</fs:itemid></item></channel></rss>