js文字内容左右移动事件
2016-12-13 11:39
267 查看
<style type="text/css">
#gongao{width:500px;height:30px;overflow:hidden;line-height:30px;font-size:13px;font-family:'宋体';
background:#DDE5ED;color:#0C77CF;font-weight:bold; position: absolute;right: 20px;top: 100px;}
#gongao #scroll_begin, #gongao #scroll_end{display:inline}
</style>
<!-- js字体左右移动-->
<script type="text/javascript">
function ScrollImgLeft(){
var speed=50; //设置调用时间
var scroll_div = document.getElementById("scroll_div"); //获取left需要移动的idv
function Marquee(){
if(scroll_div.scrollLeft>300)
scroll_div.scrollLeft=0;
else
scroll_div.scrollLeft++;
}
var MyMar=setInterval(Marquee,speed); //每多少秒调用一次该函数
scroll_div.onmouseover=function() {clearInterval(MyMar);} //鼠标移动停止移动事件
scroll_div.onmouseout=function() {MyMar=setInterval(Marquee,speed);} //离开运行移动
}
</script>
<div id="gongao">
<div style="width:500px;height:30px;margin:0 auto;white-space: nowrap;overflow:hidden;" id="scroll_div" class="scroll_div">
<div id="scroll_begin">
由于电信对座机号码设置的管控,公司现正式更换热线号码为:028-63433266
由于电信对座机号码设置的管控,公司现正
ace6
式更换热线号码为:028-63433266
由于电信对座机号码设置的管控,公司现正式更换热线号码为:028-63433266
</div>
</div>
<script type="text/javascript">setInterval(ScrollImgLeft(),1000);</script>
</div>
#gongao{width:500px;height:30px;overflow:hidden;line-height:30px;font-size:13px;font-family:'宋体';
background:#DDE5ED;color:#0C77CF;font-weight:bold; position: absolute;right: 20px;top: 100px;}
#gongao #scroll_begin, #gongao #scroll_end{display:inline}
</style>
<!-- js字体左右移动-->
<script type="text/javascript">
function ScrollImgLeft(){
var speed=50; //设置调用时间
var scroll_div = document.getElementById("scroll_div"); //获取left需要移动的idv
function Marquee(){
if(scroll_div.scrollLeft>300)
scroll_div.scrollLeft=0;
else
scroll_div.scrollLeft++;
}
var MyMar=setInterval(Marquee,speed); //每多少秒调用一次该函数
scroll_div.onmouseover=function() {clearInterval(MyMar);} //鼠标移动停止移动事件
scroll_div.onmouseout=function() {MyMar=setInterval(Marquee,speed);} //离开运行移动
}
</script>
<div id="gongao">
<div style="width:500px;height:30px;margin:0 auto;white-space: nowrap;overflow:hidden;" id="scroll_div" class="scroll_div">
<div id="scroll_begin">
由于电信对座机号码设置的管控,公司现正式更换热线号码为:028-63433266
由于电信对座机号码设置的管控,公司现正
ace6
式更换热线号码为:028-63433266
由于电信对座机号码设置的管控,公司现正式更换热线号码为:028-63433266
</div>
</div>
<script type="text/javascript">setInterval(ScrollImgLeft(),1000);</script>
</div>
相关文章推荐
- 超级简单实现内容的左右移动js+jquery+html
- js键盘上下左右(方向键)事件
- 左右移动的js分割面板
- 图片或文字上下左右滚动【JS向上滚动、JS向下滚动、JS向左滚动、JS向右滚动】【整理综合】
- 移动开发中的上下左右滑动插件jquery.swipe.js
- 提示信息 感应鼠标移动事件 自动显示url页面内容
- js文字滚动(上下左右)
- 左右移动转换文字特效HTML代码解析
- 左右移动的js分割面板
- 【网络搜集】JS在文本框光标处插入文字内容的实例
- 表格中用js左右添加从下拉列表中选择的内容
- JavaScript js 左右移动下拉列表选项
- JavaScript js 左右移动下拉列表选项
- 捕获input文本框内容改变事件的js代码
- 左右互换内容的JS代码
- Iframe的简单应用,js实现图片左右移动
- js设置图片或文字自动左右滚动控制,鼠标经过停留
- JS文字间隔性滚动代码/文字左右滚动