-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
146 lines (124 loc) · 3.78 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
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE html>
<html lang="en">
<head>
<style>
/* Styling the body */
* {
padding: 0;
margin: 0;
}
/* Styling the background image by
giving its url and position */
.container {
height: 100vh;
width: 100%;
background-image: url('https://img.freepik.com/premium-photo/musical-background-with-phone-headphones-dark-background_169016-14724.jpg?w=1060');
/* Image used: */
background-size: cover;
background-position: center;
position: relative;
}
/* Styling the list tags to the
right of the navigation bar */
.nav li {
float: right;
list-style: none;
}
/* Styling the anchor tags of
the navigation bar */
.nav a {
list-style: none;
height: 50px;
line-height: 50px;
font-size: 1rem;
font-weight: 550;
display: block;
padding: 5px 35px;
color: rgba(249, 254, 255, 0.975);
text-decoration: none;
}
/* Giving position and margin
to the content-div */
.content {
width: 100%;
position: absolute;
top: 45%;
}
/* Styling the left-col by
giving margin */
.left-col {
margin-left: 11%;
}
/* Styling the my sound placed
in the left-col */
.left-col h1 {
font-size: 50px;
color: crimson;
}
/* Styling the right-col */
.right-col {
float: right;
margin-right: 10%;
margin-top: -5%;
display: flex;
align-items: center;
}
/* Styling the text in the right-col */
.right-col p {
font-size: 21px;
color: rgb(248, 245, 245);
font-weight: 650;
margin-right: 20px;
}
/* Styling the cursor type
of the icon to pointer */
#icon {
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<ul class="nav">
<li><a href="#">PROFILE</a></li>
<li><a href="#">LIBRARY</a></li>
<li><a href="#">ARTISTS</a></li>
<li><a href="#">MUSIC</a></li>
<li><a href="#">HOME</a></li>
</ul>
</div>
<div class="content">
<div class="left-col">
<h1>MY <br> MUSIC</h1>
</div>
<div class="right-col">
<p>Click Here To Listen</p>
<img src="https://media.geeksforgeeks.org/wp-content/uploads/20210402235545/Pause.png" id="icon">
</div>
</div>
<audio id="mysound">
<source src="media/music.mp3" type="audio/mp3">
</audio>
<script>
let mysound = document.getElementById("mysound");
let icon = document.getElementById("icon");
// Creating a function that will change
// pause to play and vice-versa
icon.onclick = function () {
if (mysound.paused) {
// If paused then play the
// music and change the image
mysound.play();
icon.src =
"https://media.geeksforgeeks.org/wp-content/uploads/20210402235545/Pause.png";
} else {
// If playing then pause the
// music and change the image
mysound.pause();
icon.src =
"https://media.geeksforgeeks.org/wp-content/uploads/20210402235520/play.png";
}
}
</script>
</body>
</html>