js无间断滚动新闻js.支持火狐和IE
来源:互联网 发布:网络学习平台 编辑:程序博客网 时间:2024/06/03 11:18
var container = null;
var clone = null;
var rollingTop = function() {
//alert(container.scrollTop + "=-===" + clone.offsetTop);
if (container.scrollTop == clone.offsetTop) {
container.scrollTop = 0;
} else {
container.scrollTop++;
}
}
var rollingBottom = function() {
if (container.scrollTop == 0) {
container.scrollTop = clone.offsetTop;
} else {
container.scrollTop--;
}
}
var rollingLeft = function() {
if (container.scrollLeft == clone.offsetLeft) {
container.scrollLeft = 0;
} else {
container.scrollLeft++;
}
}
var rollingRight = function() {
if (container.scrollLeft == 0) {
container.scrollLeft = clone.offsetLeft;
} else {
container.scrollLeft--;
}
}
//top JS
function Marquee(id, speed, type) {
container = document.getElementById(id);
original = document.getElementById("default");
clone = document.getElementById("inner")
clone.innerHTML = original.innerHTML;
var functionTag = null;
if (type == "Up") {
functionTag = rollingTop;
}
else if (type == "Down") {
functionTag = rollingBottom;
}
else if (type == "Left") {
SetLeftCss(original, clone);
functionTag = rollingLeft;
}
else if (type == "Right") {
SetLeftCss(original, clone);
functionTag = rollingRight;
} else { return; }
var timer = setInterval(functionTag, speed); //设置定时器
container.onmouseover = function() { clearInterval(timer) } //鼠标移到marquee上时,清除定时器,停止滚动
container.onmouseout = function() { timer = setInterval(functionTag, speed) } //鼠标移开时重设定时器
}
function SetLeftCss(obj, obj1) {
obj.style.styleFloat = "left";
obj1.style.styleFloat = "left";
obj.style.cssFloat = "left";
obj1.style.cssFloat = "left";
obj.style.width = "400px";
obj1.style.width = "400px";
}
net自定义控件中调用方法:
const string KEY="SSSSCROLLNEWS";
if (!Page.ClientScript.IsStartupScriptRegistered(this.GetType(),KEY))
{
Page.ClientScript.RegisterStartupScript(this.GetType(), KEY, string.Format("<script>Marquee('SSS{0}', {1}, '{2}');</script>", divId, this.Speed, this.Direction
.ToString()));
}
- js无间断滚动新闻js.支持火狐和IE
- 无间断滚动的新闻文章列表--兼容IE和FF
- 无间断滚动的新闻文章列表,兼容IE、Firefox和Oper...
- 图片无间断滚动JS实现代码
- [JS效果]无间断滚动程序
- 新闻列表无间断滚动
- js 图片链接滚动代码 兼容火狐和ie
- js兼容ie和火狐支持获取图片大小和显示
- JavaScript js无间断滚动效果 scrollLeft方法 使用模板
- 支持IE和火狐浏览器的加入收藏夹js代码
- js 复制到剪贴板 ,兼容支持火狐firefox 和 ie
- 半透明广告部分js代码(支持ie和火狐)
- css和js支持ie却不支持火狐的情况
- JS无缝滚动[适合火狐 IE ]
- JS间断 / 不间断向左滚动
- 无间断的滚动新闻列表特效 兼容Firefox浏览器
- 兼容ie和火狐的js无缝八向滚动特效代码
- 兼容IE和Firefox火狐的上下、左右循环滚动JS代码
- FLEX 与现有开发语言的通信全面解析
- ie火狐兼容的几个js问题
- 国内八大网络硬盘对比分析
- 春节年年过程 时日却不同
- php的环境配置
- js无间断滚动新闻js.支持火狐和IE
- dataset、dataview、 datatable、 datacolum、datarow的关系
- 常见的样式
- xcopy 网络共享文件
- C++编译错误解决方法
- 用ECLIPSE带OSGI包安装自己开发 BOUNDLE 全过程
- Windows 7使用宝典安装技巧篇之——如何在Win7桌面上显示“我的电脑”
- USB 驱动分析——Linux
- linux cp命令详解