-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshow-hiden.html
49 lines (43 loc) · 1.09 KB
/
show-hiden.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.father {
width: 230px;
height: 65px;
overflow: hidden;
resize: horizontal;
}
.test {
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
.tag {
display: inline-block;
width: 10px;
height: 10px;
background: red;
}
</style>
</head>
<body>
<div class="father">
<div class="test">
测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试
<span class="tag"></span>
</div>
</div>
<script>
let tag = document.querySelector(".tag");
new IntersectionObserver(([change]) => {
console.log(change.isIntersecting);
}).observe(tag);
</script>
</body>
</html>