当前位置:网站首页>JS realizes the effect of text scrolling marquee
JS realizes the effect of text scrolling marquee
2022-07-04 04:18:00 【Undefind_ object】
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
#scroll_div {
height: 30px;
line-height: 30px;
overflow:hidden;
white-space: nowrap;
width: 800px;
background-color: #23527c;
color: #d8d8d8;
margin: 1rem 0;
text-align: center;
}
#scroll_begin,#scroll_end {
display: inline;
}
</style>
</head>
<body>
<div id="scroll_div">
<div id="scroll_begin">
<span class="pad_right"> This is the first one ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah </span>
</div>
<div id="scroll_end"></div>
</div>
<script>
function ScrollImgLeft() {
var speed = 20;// Initialization speed That is, the overall scrolling speed of the font
var MyMar = null;// Initialize a variable to be empty Used to store the obtained text content
var scroll_begin = document.getElementById("scroll_begin");// Get the beginning of the scroll id
var scroll_end = document.getElementById("scroll_end");// Get the end of scrolling id
var scroll_div = document.getElementById("scroll_div");// Get the beginning of the whole id
scroll_end.innerHTML = scroll_begin.innerHTML;// Scrolling is html Internal content , Native knowledge !
// Define a method
function Marquee() {
if (scroll_end.offsetWidth - scroll_div.scrollLeft <= 0){
scroll_div.scrollLeft -= scroll_begin.offsetWidth;
} else{
scroll_div.scrollLeft++;
}
}
MyMar = setInterval(Marquee, speed);
// Slide in pause
scroll_div.onmouseover = function () {
clearInterval(MyMar);
}
// Slide out continue
scroll_div.onmouseout = function () {
MyMar = setInterval(Marquee, speed);
}
}
ScrollImgLeft();
</script>
</body>
</html>
边栏推荐
- LNK2038 检测到“RuntimeLibrary”的不匹配项: 值“MD_DynamicRelease”不匹配值“MDd_DynamicDebug”(main.obj 中)
- SQL語句加强練習(MySQL8.0為例)
- The difference between bagging and boosting in machine learning
- Lnk2038 detected a mismatch of "runtimelibrary": the value "md_dynamicrelease" does not match the value "mdd_dynamicdebug" (in main.obj)
- Understand the principle of bytecode enhancement technology through the jvm-sandbox source code
- [paddleseg source code reading] paddleseg custom data class
- Infiltration practice guest account mimikatz sunflower SQL rights lifting offline decryption
- Balance between picture performance of unity mobile game performance optimization spectrum and GPU pressure
- Katalon使用script实现查询List大小
- leetcode刷题:二叉树05(翻转二叉树)
猜你喜欢

Parameterization of controls in katalon

Getting started with the go language is simple: go implements the Caesar password

函数计算异步任务能力介绍 - 任务触发去重

【微服务|openfeign】@FeignClient详解

Two sides of the evening: tell me about the bloom filter and cuckoo filter? Application scenario? I'm confused..

02 specific implementation of LS command

Confession code collection, who says program apes don't understand romance

三年进账35.31亿,这个江西老表要IPO了

Reduce function under functools

深度优先搜索简要讲解(附带基础题)
随机推荐
Flink学习6:编程模型
Huawei cloud Kunpeng engineer training (Guangxi University)
leetcode刷题:二叉树04(二叉树的层序遍历)
idea修改主体颜色
CesiumJS 2022^ 源码解读[0] - 文章目录与源码工程结构
Smart subway | cloud computing injects wisdom into urban subway transportation
Programmers' telecommuting is mixed | community essay solicitation
Infiltration practice guest account mimikatz sunflower SQL rights lifting offline decryption
三菱M70宏变量读取三菱M80公共变量采集三菱CNC变量读取采集三菱CNC远程刀补三菱机床在线刀补三菱数控在线测量
vim正确加区间注释
Epidemic strikes -- Thinking about telecommuting | community essay solicitation
02 ls 命令的具体实现
Sales management system of lightweight enterprises based on PHP
Pandora IOT development board learning (HAL Library) - Experiment 6 independent watchdog experiment (learning notes)
ctf-pikachu-CSRF
vue多级路由嵌套怎么动态缓存组件
Balance between picture performance of unity mobile game performance optimization spectrum and GPU pressure
Select sorting and bubble sorting template
[csrf-01] basic principle and attack and defense of Cross Site Request Forgery vulnerability
Penetration practice - sqlserver empowerment