Skip to content

Instantly share code, notes, and snippets.

@hcmn
Created July 11, 2012 20:27
Show Gist options
  • Save hcmn/3093085 to your computer and use it in GitHub Desktop.
Save hcmn/3093085 to your computer and use it in GitHub Desktop.
JQuery UI: slider
<html>
<head>
<title>Sliders!</title>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/base/jquery-ui.css"/>
<link rel="stylesheet" href="style.css"/>
</head>
<body>
<div class="panel">
<div id="slider"></div>
<p>
Volume : <span id="volume">0</span>%
</p>
</div>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js" type="text/javascript"></script>
<script src="script.js"></script>
</html>
$(function() {
$("#slider").slider({
stop: function ( event, ui ) {
// Use jQuery to select the 'volume' <span> and then
// set it to the value of the slider.
$('#volume').html($('#slider').slider("value"));
}
});
});
body {
font-family:sans-serif;
font-size:16pt;
font-weight:bold;
}
.panel {
text-align:center;
line-height:20pt;
background: #F3F3F3;
padding:5pt;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment