Created
July 11, 2012 20:27
-
-
Save hcmn/3093085 to your computer and use it in GitHub Desktop.
JQuery UI: slider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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")); | |
} | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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