-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex-105.html
130 lines (112 loc) · 3.44 KB
/
ex-105.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Theme Made By www.w3schools.com - No Copyright -->
<title>Bootstrap Theme Simply Me</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link href="http://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<style>
body {
font: 20px Montserrat, sans-serif;
line-height: 1.8;
color: #f5f6f7;
}
p {font-size: 16px;}
.margin {margin-bottom: 45px;}
.bg-1 {
background-color: #1abc9c; /* Green */
color: #ffffff;
}
.bg-2 {
background-color: #474e5d; /* Dark Blue */
color: #ffffff;
}
.bg-3 {
background-color: #ffffff; /* White */
color: #555555;
}
.bg-4 {
background-color: #2f2f2f; /* Black Gray */
color: #fff;
}
.container-fluid {
padding-top: 70px;
padding-bottom: 70px;
}
.navbar {
padding-top: 15px;
padding-bottom: 15px;
border: 0;
border-radius: 0;
margin-bottom: 0;
font-size: 12px;
letter-spacing: 5px;
}
.navbar-nav li a:hover {
color: #1abc9c !important;
}
</style>
</head>
<body>
<!-- Navbar -->
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Me</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav navbar-right">
<li><a href="#">WHO</a></li>
<li><a href="#">WHAT</a></li>
<li><a href="#">WHERE</a></li>
</ul>
</div>
</div>
</nav>
<!-- First Container -->
<div class="container-fluid bg-1 text-center">
<h3 class="margin">Who Am I?</h3>
<img id="photo" src="CKSKPTA.jpg" id="picture" class="img-responsive img-circle margin"
style="display:inline" alt="" width="350" height="350">
<h3>Hi, My name is <span class="name">Doraemon</span>, an adventurer!</h3>
</div>
<!-- Second Container -->
<div class="container-fluid bg-2 text-center">
<h3 class="margin">Who Am I?</h3>
<p>My email address is <span class="email">[email protected]</span></p>
<p>My address is <span class="address">Doraemon City</span></p>
</div>
<!-- Footer -->
<footer class="container-fluid bg-4 text-center">
<p>Bootstrap Theme Made By <a href="http://www.w3schools.com">www.w3schools.com</a></p>
</footer>
<script src="scripts/jquery-3.1.0.js"></script>
<script type="text/javascript">
$.ajax({
url: 'https://randomuser.me/api/',
dataType: 'json',
success: function(data) {
// code here...
console.log( data );
// todo: 將透過 api 拿回來的資料更新至網頁上
// 1. #photo 頭像
$('#photo').attr('src', data.results[0].picture.large);
console.log(data.results[0]);
// 2. .name 姓名
$('.name').text(data.results[0].name.first+' '+data.results[0].name.last);
// 3. .email email
$('.email').text(data.results[0].email);
// 4. .address 地址
$('.address').text(data.results[0].location.street+', '+data.results[0].location.city+', '+data.results[0].location.state+', '+data.results[0].location.postcode);
}
});
</script>
</body>
</html>