-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
28 lines (24 loc) · 844 Bytes
/
index.js
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
function orientScreen() {
if (screen.orientation.type.startsWith('landscape')) {
document.getElementById('img').src = 'image.png';
} else {
document.getElementById('img').src = 'phone-image.png';
}
}
screen.orientation.addEventListener('change', function(e) {
orientScreen();
});
document.getElementById('playPauseButton').addEventListener('click', function() {
const audio = document.getElementById('audio');
if (audio.paused) {
audio.play();
document.getElementById('playPauseImg').src = 'pause-fill.svg';
} else {
audio.pause();
document.getElementById('playPauseImg').src = 'play-fill.svg';
}
});
document.getElementById('audio').addEventListener('ended', function() {
document.getElementById('playPauseImg').src = 'play-fill.svg';
});
orientScreen();