I'm struggling to make this code work in a standalone HTML file: http://jsfiddle.net/J8XaX/2/
Here is the script I am using:
var divs = $('.fademe');
$(window).on('scroll', function() {
var st = $(this).scrollTop();
divs.css({ 'opacity' : (1 - st/130) });
});
I've attempted to include these scripts without success:
<script type='text/javascript' src='http://code.jquery.com/jquery-1.7.1.js'></script>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.7.1.min.js'></script>
<script src="http://code.jquery.com/jquery-latest.js"></script>
Any advice or suggestions?
EDIT: It appears that the script is wrapped in my HTML document:
<script type='text/javascript'>
$(document).ready(function(){
var divs = $('.fademe');
$(window).on('scroll', function() {
var st = $(this).scrollTop();
divs.css({ 'opacity' : (1 - st/700) });
});
</script>
The script works in jsFiddle, but unfortunately does not seem to work when viewed as its own HTML page.