当前位置:网站首页>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>
边栏推荐
- leetcode刷题:二叉树05(翻转二叉树)
- JS实现文字滚动 跑马灯效果
- The new data center helps speed up the construction of a digital economy with data as a key element
- 【CSRF-01】跨站请求伪造漏洞基础原理及攻防
- There is a problem that the package cannot be parsed in the like project
- 分布式系统:what、why、how
- ctf-pikachu-CSRF
- 【读书会第十三期】视频文件的封装格式
- Understand the principle of bytecode enhancement technology through the jvm-sandbox source code
- How was my life in 2021
猜你喜欢

10 reasons for not choosing to use free virtual hosts

Two commonly used graphics can easily realize data display

I Build a simple microservice project

Lnk2038 detected a mismatch of "runtimelibrary": the value "md_dynamicrelease" does not match the value "mdd_dynamicdebug" (in main.obj)
![Cesiumjs 2022^ source code interpretation [0] - article directory and source code engineering structure](/img/ba/c1d40de154344ccc9f2fd1dd4cb12f.png)
Cesiumjs 2022^ source code interpretation [0] - article directory and source code engineering structure

leetcode刷题:二叉树05(翻转二叉树)

【微服务|openfeign】@FeignClient详解

Flink learning 7: application structure

The maximum expiration time of client secret in azure ad application registration is modified to 2 years

Balance between picture performance of unity mobile game performance optimization spectrum and GPU pressure
随机推荐
hbuildx中夜神模拟器的配置以及热更新
Redis cluster view the slots of each node
01 QEMU starts the compiled image vfs: unable to mount root FS on unknown block (0,0)
Parameterization of controls in katalon
ctf-pikachu-CSRF
Mitsubishi M70 macro variable reading Mitsubishi M80 public variable acquisition Mitsubishi CNC variable reading acquisition Mitsubishi CNC remote tool compensation Mitsubishi machine tool online tool
The three-year revenue is 3.531 billion, and this Jiangxi old watch is going to IPO
Introduction to asynchronous task capability of function calculation - task trigger de duplication
leetcode刷题:二叉树09(二叉树的最小深度)
2020 Bioinformatics | TransformerCPI
Katalon使用script实现查询List大小
I Build a simple microservice project
[webrtc] M98 Ninja build and compile instructions
Interpretation of leveldb source code skiplist
Epidemic strikes -- Thinking about telecommuting | community essay solicitation
三菱M70宏变量读取三菱M80公共变量采集三菱CNC变量读取采集三菱CNC远程刀补三菱机床在线刀补三菱数控在线测量
Idea configuration 360zip open by default -- external tools
Two sides of the evening: tell me about the bloom filter and cuckoo filter? Application scenario? I'm confused..
Myslq delete followed by limit
Exercices de renforcement des déclarations SQL (MySQL 8.0 par exemple)