Difference between revisions of "Template:Freiburg/wiki content start"
Line 4: | Line 4: | ||
$(document).ready(function(){ | $(document).ready(function(){ | ||
− | var $blob | + | var $blob = $("#upwards_blob"), |
− | $window | + | $window = $(window), |
− | $pageheight | + | $pageheight = $(document).height()-$window.height(), |
+ | $offset = $blob.offset(), | ||
+ | topPadding = 15; | ||
console.log('pageheight:'+$pageheight); | console.log('pageheight:'+$pageheight); | ||
Line 36: | Line 38: | ||
if ($window.scrollTop() > ($pageheight-430)) { | if ($window.scrollTop() > ($pageheight-430)) { | ||
console.log('greater'); | console.log('greater'); | ||
− | $blob.css({"transform":"translate(-150px, | + | $blob.css({"transform":"translate(-150px, 0)"}); |
+ | if ($window.scrollTop() > offset.top) { | ||
+ | $blob.stop().animate({ | ||
+ | marginTop: $window.scrollTop() - offset.top + topPadding | ||
+ | }); | ||
+ | } | ||
+ | else { | ||
+ | $blob.stop().animate({ | ||
+ | marginTop: 0 | ||
+ | }); | ||
+ | } | ||
} | } | ||
} | } |
Revision as of 20:42, 6 September 2015