-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path29.聚美优品固定导航实现.html
52 lines (51 loc) · 1.4 KB
/
29.聚美优品固定导航实现.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
50
51
52
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>聚美优品固定导航的实现</title>
<style>
*{
margin:0px;
padding:0px;
}
.nav{
width:50px;
height:300px;
border:solid 1px #ccc;
background:orchid;
position: fixed;
top:150px;
left:50px;
opacity: 1;/*完全不透明*/
transform:scale(1.5,1.5);/*放大效果*/
}
.navh{
opacity: 0;/*完全透明*/
transform:scale(1,1);/*保持原来的大小*/
}
</style>
</head>
<body>
<!-- 放图片撑开滚动条 -->
<img src="./file/jumei.png" alt="">
<div class="nav navh">
</div>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script>
$(function(){
// 、、滚动监听事件
$(window).scroll(function(){
var xx = $(document).scrollTop();
document.title = xx;
if(xx>800){
$(".nav").removeClass("navh");
}else{
$(".nav").addClass("navh");
}
});
});
</script>
</body>
</html>