javascript
html向上浮动的方式,JS 实现Div向上浮动的实现代码
Html 及 JS 代碼如下:
復制代碼 代碼如下:
style="position: absolute; width: 100px;">
我們
var newsOne = document.getElementById("newsOne");
newsOne.style.bottom = 0;
newsOne.style.left = window.screen.availWidth - 100;
var bottom = 0;
function newsScroll() {
if (bottom > (window.screen.availHeight - window.screenTop)) {
bottom = 0;
newsOne.style.bottom = 0;
}
else {
bottom = bottom + 15;
newsOne.style.bottom = bottom;
}
}
var timeid = setInterval(newsScroll, 300);
function CleartTimeInterVal() {
clearInterval(timeid);
}
function resetInterVal() {
timeid = setInterval(newsScroll, 300);
}
在線運行:
我們
var newsOne = document.getElementById("newsOne");
newsOne.style.bottom = 0;
newsOne.style.left = window.screen.availWidth - 100;
var bottom = 0;
function newsScroll() {
if (bottom > (window.screen.availHeight - window.screenTop)) {
bottom = 0;
newsOne.style.bottom = 0;
}
else {
bottom = bottom + 15;
newsOne.style.bottom = bottom;
}
}
var timeid = setInterval(newsScroll, 300);
function CleartTimeInterVal() {
clearInterval(timeid);
}
function resetInterVal() {
timeid = setInterval(newsScroll, 300);
}
[Ctrl+A 全選 注:如需引入外部Js需刷新才能執行]
時間: 2012-10-08
總結
以上是生活随笔為你收集整理的html向上浮动的方式,JS 实现Div向上浮动的实现代码的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 怎么用u盘进bos检测硬盘 使用U盘进入
- 下一篇: java模块化按需加载,JavaScri