Add definitions for ScrollToFixed

https://github.com/bigspotteddog/ScrollToFixed
This commit is contained in:
Ben Dixon
2015-06-18 15:09:37 +01:00
parent 43b6bf8875
commit dea8dc1a00
2 changed files with 78 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
/// <reference path="scrolltofixed.d.ts" />
$(document).ready(function() {
$('#mydiv').scrollToFixed();
});
$(document).ready(function() {
$('.header').scrollToFixed({
preFixed: function() { $(this).find('h1').css('color', 'blue'); },
postFixed: function() { $(this).find('h1').css('color', ''); }
});
$('.footer').scrollToFixed( {
bottom: 0,
limit: $('.footer').offset().top,
preFixed: function() { $(this).find('h1').css('color', 'blue'); },
postFixed: function() { $(this).find('h1').css('color', ''); }
});
// Order matters because our summary limit is based on the position
// of the footer. On window refresh, the summary needs to recalculate
// after the footer.
$('#summary').scrollToFixed({
marginTop: $('.header').outerHeight() + 10,
limit: function() {
var limit = $('.footer').offset().top - $('#summary').outerHeight(true) - 10;
return limit;
},
zIndex: 999,
preFixed: function() { $(this).find('.title').css('color', 'blue'); },
preAbsolute: function() { $(this).find('.title').css('color', 'red'); },
postFixed: function() { $(this).find('.title').css('color', ''); },
postAbsolute: function() { $(this).find('.title').css('color', ''); }
});
});