jQM - Detect slidestop event
by kalmarsh80
HTML
<link rel="stylesheet" href="http://jeromeetienne.github.com/jquery-mobile-960/css/jquery-mobile-fluid960.css">
<script src="http://timeago.yarp.com/jquery.timeago.js"></script>
<script src="http://imakewebthings.github.com/jquery-waypoints/waypoints.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<title>jQM Complex Demo</title>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=no; target-densityDpi=device-dpi"/>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.1/jquery.mobile-1.4.1.min.css" />
<!--<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>-->
<script src="http://code.jquery.com/mobile/1.4.1/jquery.mobile-1.4.1.min.js"></script>
</head>
<body>
<div id="homeContainer" data-role="page">
<h2>hi</h2>
<div data-role="content" class="full-width-slider">
</div>
</div>
<script>
$(document).ready(function(){
//setTimeout(function(){
var x = $( "#volume-slider" ).on( "slidestop", function( event, ui ) {
//alert('Slide Stop!');
alert($(this).val());
$("h2").text( $(this).val() );
});
//}, 1000);
$(".full-width-slider").html('<label for="slider-fill">Lautstärke:</label> <input id="volume-slider" type="range" name="slider-fill" step="33" value="33" min="0" max="100" data-highlight="true" /> <div class="slider-footer"> <span style="position:absolute; left:0;">Very Short</span> <span style="position:absolute; left:32%;">Short</span> <span style="position:absolute; left:65%;">Medium</span> <span style="position:absolute; left:98%;">Long</span> </div>');
$('#homeContainer').trigger('create');
$( "#volume-slider" ).slider( "refresh" );
x();
});
...
CSS
/* Hide the number input */
.full-width-slider input {
display: none !important;
border:none;
box-shadow:none;
}
.full-width-slider .ui-slider-track {
margin-left: 15px;
}
.slider-footer{
margin-left:5px;
position: relative;
height: 5px;
margin-right: 15px;
font-size:11px;
}