-
Notifications
You must be signed in to change notification settings - Fork 239
Expand file tree
/
Copy pathforms1-audio.html
More file actions
91 lines (82 loc) · 2.37 KB
/
Copy pathforms1-audio.html
File metadata and controls
91 lines (82 loc) · 2.37 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Audio player on a page with form fields | Able Player Demos</title>
<link rel="stylesheet" href="demos.css" type="text/css">
<!-- Dependencies -->
<script src="https://code.jquery.com/jquery-3.7.1.slim.min.js" integrity="sha256-kmHvs0B+OpCW5GVHUNjv9rOmY0IvSIRcf7zGUDTDQM8=" crossorigin="anonymous"></script>
<!-- Able Player CSS -->
<link rel="stylesheet" href="../build/ableplayer.min.css" type="text/css"/>
<!-- Able Player JavaScript -->
<script src="../build/ableplayer.dist.js"></script>
</head>
<body>
<header>
<div class="title">Able Player Demos</div>
</header>
<nav>
<ul>
<li><a href="index.html">More demos</a></li>
<li><a href="https://ableplayer.github.io/ableplayer">Able Player Docs</a></li>
</ul>
</nav>
<main>
<h1>Audio player on a page with form fields</h1>
<div id="container">
<audio id="audio1" preload="auto" data-able-player>
<source type="audio/mpeg" src="../media/smallf.mp3"/>
<source type="audio/ogg" src="../media/smallf.ogg"/>
</audio>
<h2>Form Fields</h2>
<p>When users are interacting with form fields, their keystrokes should not be handled by the player.</p>
<style>
.form label, .form input {
display: block;
margin-bottom: 0.5em;
font-size: 1em;
}
.form label {
font-weight: bold;
}
.form #feedback {
font-weight: bold;
font-size: 1.1em;
color: black;
background-color: #FFC;
padding: 0.5em;
margin: 1em 0;
width: 20em;
text-align: center;
border: thin solid #340449;
display: none;
}
</style>
<script>
(function () {
var feedback, answer;
$(document).ready(function () {
$('#submit').on( 'click', function() {
answer = $('#favplayer').val().toLowerCase();
if (answer.substring(0,4) == 'able') {
feedback = 'Correct!';
} else {
feedback = 'Wrong answer! Please try again.';
}
$('#feedback').text(feedback).show();
$('#favplayer').trigger('focus');
})
});
})();
</script>
<div class="form">
<div id="feedback" role="alert"></div>
<label for="favplayer">What's your favorite media player?</label>
<input type="text" id="favplayer">
<input type="submit" value="Submit" id="submit">
</div>
</div>
</main>
</body>
</html>