Team:NCTU Formosa/source/head
From 2013.igem.org
(Difference between revisions)
Line 81: | Line 81: | ||
$.fn.followTo = function (pos) { | $.fn.followTo = function (pos) { | ||
var $this = this, | var $this = this, | ||
- | $window = $(window) | + | $window = $(window), |
- | + | $tocf = false; | |
$window.scroll(function (e) { | $window.scroll(function (e) { | ||
if ($window.scrollTop() < pos) { | if ($window.scrollTop() < pos) { | ||
Line 88: | Line 88: | ||
position: 'absolute', | position: 'absolute', | ||
top: '0px' | top: '0px' | ||
- | });tocf = false; | + | }); |
+ | $tocf = false; | ||
} else { | } else { | ||
$this.css({ | $this.css({ | ||
position: 'fixed', | position: 'fixed', | ||
top: '78px' | top: '78px' | ||
- | });tocf = true; | + | }); |
+ | $tocf = true; | ||
} | } | ||
}); | }); | ||
Line 103: | Line 105: | ||
$(document).scroll(function() { | $(document).scroll(function() { | ||
- | if ($(document).scrollTop() > 800 && tocf) { | + | if ($(document).scrollTop() > 800 && $tocf==true) { |
if (!away) { | if (!away) { | ||
away = true; | away = true; |
Revision as of 19:23, 15 September 2013