Team:UNITN-Trento/JS/Parts
From 2013.igem.org
(Difference between revisions)
Line 4: | Line 4: | ||
var height = $(".tn-parts.container .content").css('height'); | var height = $(".tn-parts.container .content").css('height'); | ||
var margin = $(".tn-parts-container .menu").css('margin-top'); | var margin = $(".tn-parts-container .menu").css('margin-top'); | ||
- | if(height >= scroll) { margin = scroll; } | + | if ( undefined == margin ) { |
+ | margin = 0; | ||
+ | } | ||
+ | if ( height >= scroll ) { margin = scroll; } | ||
$(".tn-parts-container .menu").css({'margin-top' : margin}); | $(".tn-parts-container .menu").css({'margin-top' : margin}); | ||
}); | }); | ||
}); | }); |
Revision as of 12:47, 19 September 2013
$(document).ready(function() { oSch(function() { var scroll = $("#tn-main-wrap-wrap").scrollTop(); var height = $(".tn-parts.container .content").css('height'); var margin = $(".tn-parts-container .menu").css('margin-top'); if ( undefined == margin ) { margin = 0; } if ( height >= scroll ) { margin = scroll; } $(".tn-parts-container .menu").css({'margin-top' : margin}); }); });