机顶盒端字体滚动
Sep 20, 2019
字体滚动
this.marquee = function (status,id) {
# status add 开始 传空清除结束
var scrollLeft = 0;
this.timer && clearInterval(this.timer);
var div = getId(id);
if (!div) return
if (status == 'add') {
if (div.innerHTML.length < 8) return
scrollLeft = div.offsetWidth
div.style.cssText = "text-indent: " + scrollLeft + "px;text-align: center;text-overflow: clip;"
this.timer = setInterval(function () {
if (scrollLeft <= -div.offsetWidth + 20) {
scrollLeft = div.offsetWidth;
div.style.cssText = "text-indent: " + scrollLeft + "px;text-align: center;text-overflow: clip;"
} else {
scrollLeft += -1;
div.style.cssText = "text-indent: " + scrollLeft + "px;text-align: center;text-overflow: clip;"
}
}, 30);
} else {
if (div.innerHTML.length >= 8) {
scrollLeft = 0;
div.style.cssText = "text-indent: " + scrollLeft + "px;text-align: center;"
}
}
};
# getId封装获取id的function 内容:return document.getElementById(arg);