Nie jest to najnowsza wersja dokumentacji!
Click here for the latest released version.
volumeupbutton
Zdarzenie fires, gdy użytkownik naciśnie klawisz głośności przycisk.
document.addEventListener("volumeupbutton", yourCallbackFunction, false);
Szczegóły
Jeśli chcesz zastąpić domyślne głośności zachowanie można zarejestrować detektor zdarzeń dla volumeupbutton
zdarzenie.
Aplikacje zwykle należy użyć document.addEventListener
Aby dołączyć słuchacza raz [deviceready](events.deviceready.html)
pożary zdarzenia.
Obsługiwane platformy
- BlackBerry 10
- Android
Szybki przykład
document.addEventListener("volumeupbutton", onVolumeUpKeyDown, false);
function onVolumeUpKeyDown() {
// Handle the volume up button
}
Pełny przykład
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Volume Up Button Example</title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for device API libraries to load
//
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
// device APIs are available
//
function onDeviceReady() {
// Register the event listener
document.addEventListener("volumeupbutton", onVolumeUpKeyDown, false);
}
// Handle the volume up button
//
function onVolumeUpKeyDown() {
}
</script>
</head>
<body onload="onLoad()">
</body>
</html>