Team:NCTU Formosa/source/head
From 2013.igem.org
(Difference between revisions)
Line 19: | Line 19: | ||
} | } | ||
$(function() { | $(function() { | ||
+ | var long = false; | ||
+ | var dheight = $(document).height(); | ||
+ | var wheight = $(window).height(); | ||
+ | if($('#toc').height()+100>wheight) { long=true; } | ||
+ | |||
adjustStyle($(this).width()); | adjustStyle($(this).width()); | ||
$(window).resize(function() { | $(window).resize(function() { | ||
adjustStyle($(this).width()); | adjustStyle($(this).width()); | ||
+ | dheight = $(document).height(); | ||
+ | wheight = $(window).height(); | ||
+ | if($('#toc').height()+100>wheight) { long=true; } | ||
}); | }); | ||
var lastId, | var lastId, | ||
Line 82: | Line 90: | ||
$(document).ready(function(){ | $(document).ready(function(){ | ||
var away = false; | var away = false; | ||
- | |||
- | |||
$(document).scroll(function() { | $(document).scroll(function() { | ||
- | if ($(document).scrollTop() > | + | if ($(document).scrollTop() > dheight/2) { |
if (!away) { | if (!away) { | ||
if (long){ | if (long){ | ||
Line 91: | Line 97: | ||
$('#toc').stop().css({ | $('#toc').stop().css({ | ||
position: 'fixed' | position: 'fixed' | ||
- | }).animate({'top': -22-$('#toc').height()+ | + | }).animate({'top': -22-$('#toc').height()+wheight+'px'}, 500); |
}} | }} | ||
} else { | } else { |
Revision as of 13:54, 19 September 2013