Skip to content

Instantly share code, notes, and snippets.

@exallium
Created June 2, 2011 11:36
Show Gist options
  • Save exallium/1004273 to your computer and use it in GitHub Desktop.
Save exallium/1004273 to your computer and use it in GitHub Desktop.
Opacity Slider in HTML5/CSS3/JQuery
<script type="text/javascript" src="jquery-1.6.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#range').change(function() {
$('#page_contents').attr('style', 'opacity:' + $('#range').attr('value')/100);
});
});
</script>
<input id="range" type="range" max='100' min='0' value='100' />
<div id="page_contents">
<h1>Page Contents</h1>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment