为了账号安全,请及时绑定邮箱和手机立即绑定

关于文字向左滚动,样式的问题

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>js文字向左无缝滚动</title>
	</head>

	<body>
		<style type="text/css">
			.qimo8 {
				overflow: hidden;
				width: 300px;
			}
			
			.qimo8 .qimo {
				/*width:99999999px;*/
				width: 8000%;
				height: 30px;
			}
			
			.qimo8 .qimo div {
				float: left;
			}
			
			.qimo8 .qimo ul {
				float: left;
				height: 30px;
				overflow: hidden;
				zoom: 1;
			}
			
			.qimo8 .qimo ul li {
				float: left;
				line-height: 30px;
				list-style: none;
			}
			
			.qimo8 li a {
				margin-right: 10px;
				color: #444444;
			}
		</style>
		<div id="demo" class="qimo8">
			<div class="qimo">
				<div id="demo1">
					<ul>
						<li>
							<a href='/office/194/46163.htm'>回收站里的文件删除了怎么恢复</a>
						</li>
					</ul>
				</div>
				<div id="demo2"></div>
			</div>
		</div>
		<script type="text/javascript">
			var demo = document.getElementById("demo");
			var demo1 = document.getElementById("demo1");
			var demo2 = document.getElementById("demo2");
			demo2.innerHTML = document.getElementById("demo1").innerHTML;

			function Marquee() {
				if(demo.scrollLeft - demo2.offsetWidth >= 0) {
					demo.scrollLeft -= demo1.offsetWidth;
				} else {
					demo.scrollLeft++;
				}
			}
			var myvar = setInterval(Marquee, 30);
			demo.onmouseout = function() {
				myvar = setInterval(Marquee, 30);
			}
			demo.onmouseover = function() {
				clearInterval(myvar);
			}
		</script>
	</body>

</html>
</td>
</tr>
</table>

这里面 

	.qimo8 .qimo {
				/*width:99999999px;*/
				width: 8000%;
				height: 30px;
			}

这个是什么原理啊,求指教

正在回答

1 回答

width: 8000%;这个地方的宽度主要是要比两个demo的长度长即可,我试了一下,改成width:200%也能正常运行,这里写成8000%只是个人喜好吧`(/= _ =)

0 回复 有任何疑惑可以回复我~
#1

hou110 提问者

非常感谢!
2017-05-16 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
信息滚动效果制作
  • 参与学习       47759    人
  • 解答问题       321    个

萌妹子带您快速学习滚动效果,掌握无缝滚动和歇间性滚动的制作方法

进入课程

关于文字向左滚动,样式的问题

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信