-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
90 lines (89 loc) · 2.54 KB
/
index.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML - CSS Exercise 2</title>
<style>
body{
margin: 0;
background: #eee;
}
.mgi_device{
padding: 15px;
background: #000;
height: 48px;
box-sizing: border-box;
}
.mgi_device ul{
display: flex;
flex-direction: row;
justify-content: center;
background: #000;
color: #fff;
margin: 0;
}
.mgi_device ul li{
padding: 0 15px;
list-style-type: none;
}
.mgi_device ul li a{
text-decoration: none;
color: #fff;
}
.iframe{
display: block;
max-width: 100%;
width: 100%;
height: calc(100% - 48px);
margin: 0 auto;
transition: all 0.5s ease-in-out;
overflow-y: auto;
position: absolute;
left: 0;
right: 0;
}
iframe{
display: block;
width: 100%;
height: 100%;
margin: 0;
border: 0;
background: #ffffff;
}
.mgi_device ul li a{
color: #fff;
text-transform: uppercase;
font-weight: bold;
}
</style>
</head>
<body>
<div class="mgi_device">
<ul>
<li><a href="javascript:void(0);" onclick="chooseDevice($(this),0);" style="color: #3498db;">Desktop</a></li>
<li><a href="javascript:void(0);" onclick="chooseDevice($(this),1);">Tablet</a></li>
<li><a href="javascript:void(0);" onclick="chooseDevice($(this),2);">Mobile</a></li>
</ul>
</div>
<div class="iframe">
<iframe src="src/html.html"></iframe>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script>
function chooseDevice(unit,device){
$('ul li a').attr('style','color: #fff;');
unit.attr('style','color: #3498db;');
switch (device) {
case 1:
$('.iframe').attr('style','width: 1000px;');
break;
case 2:
$('.iframe').attr('style','width: 767px;');
break;
default:
$('.iframe').attr('style','width: 100%');
}
}
</script>
</body>
</html>