Line 757: | Line 757: | ||
e.style.display = (e.style.display == 'block') ? 'none' : 'block'; | e.style.display = (e.style.display == 'block') ? 'none' : 'block'; | ||
} | } | ||
+ | |||
+ | $(function() { | ||
+ | |||
+ | var $sidebar = $("#sidebar"), | ||
+ | $window = $(window), | ||
+ | offset = $sidebar.offset(), | ||
+ | topPadding = 15; | ||
+ | |||
+ | $window.scroll(function() { | ||
+ | if ($window.scrollTop() > offset.top) { | ||
+ | $sidebar.stop().animate({ | ||
+ | marginTop: $window.scrollTop() - offset.top + topPadding | ||
+ | }); | ||
+ | } else { | ||
+ | $sidebar.stop().animate({ | ||
+ | marginTop: 0 | ||
+ | }); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | }); | ||
</script> | </script> | ||
Revision as of 16:28, 29 October 2017