Team:NCTU Formosa/source/head
From 2013.igem.org
(Difference between revisions)
Line 79: | Line 79: | ||
} | } | ||
}); | }); | ||
- | /* | + | /*$.fn.followTo = function (pos) { |
- | $.fn.followTo = function (pos) { | + | |
var $this = this, | var $this = this, | ||
$window = $(window); | $window = $(window); | ||
Line 99: | Line 98: | ||
} | } | ||
}); | }); | ||
- | }; | + | };*/ |
- | $ | + | $.fn.followTo = function (pos) { |
- | + | var $this = this, | |
- | + | $window = $(window); | |
- | var $ | + | |
- | $window | + | |
- | + | ||
- | + | ||
- | $window.scroll(function() { | + | $window.scroll(function (e) { |
- | if ($window.scrollTop() | + | if ($window.scrollTop() < pos) { |
- | $ | + | $this.removeClass('fixed'); |
} else { | } else { | ||
- | $ | + | $this.addClass('fixed'); |
} | } | ||
}); | }); | ||
+ | }; | ||
+ | $('#toc').followTo(431); | ||
}); | }); | ||
</script> | </script> |
Revision as of 14:31, 31 August 2013