Team:BIT-China/js/model sidebar.js
From 2013.igem.org
(Difference between revisions)
Singlewindy (Talk | contribs) |
Singlewindy (Talk | contribs) |
||
(5 intermediate revisions not shown) | |||
Line 3: | Line 3: | ||
var modeling = $("#modeling").offset().top; | var modeling = $("#modeling").offset().top; | ||
var overview = $('#overview').offset().top - 110; | var overview = $('#overview').offset().top - 110; | ||
- | var Noise_in_the_cell = $("#Noise_in_the_cell").offset().top - 110; | + | var Noise_in_the_cell = $("#Noise_in_the_cell").offset().top - 110; |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
var Quorum_Control_system = $('#Quorum_Control_system').offset().top - 110; | var Quorum_Control_system = $('#Quorum_Control_system').offset().top - 110; | ||
var qsd = $('#qsd').offset().top - 110; | var qsd = $('#qsd').offset().top - 110; | ||
var rd = $('#rd').offset().top - 110; | var rd = $('#rd').offset().top - 110; | ||
var pc = $('#pc').offset().top - 110; | var pc = $('#pc').offset().top - 110; | ||
+ | var Heat_Resistant_system = $('#Heat_Resistant_system').offset().top - 110; | ||
+ | var des = $('#des').offset().top - 110; | ||
+ | var si = $('#si').offset().top - 110; | ||
+ | var re = $('#re').offset().top - 110; | ||
var temp = document.getElementById("mercury"); | var temp = document.getElementById("mercury"); | ||
Line 19: | Line 19: | ||
if($w.scrollTop() > overview) | if($w.scrollTop() > overview) | ||
temp.style.height = '25px'; | temp.style.height = '25px'; | ||
- | + | if($w.scrollTop() > Noise_in_the_cell) | |
- | + | temp.style.height = '50px'; | |
- | if($w.scrollTop() > | + | if($w.scrollTop() > Quorum_Control_system) |
temp.style.height = '75px'; | temp.style.height = '75px'; | ||
- | if($w.scrollTop() > | + | if($w.scrollTop() > qsd) |
- | + | ||
- | + | ||
temp.style.height = '125px'; | temp.style.height = '125px'; | ||
- | + | if($w.scrollTop() > rd) | |
- | + | ||
- | + | ||
temp.style.height = '175px'; | temp.style.height = '175px'; | ||
- | + | if($w.scrollTop() > pc) | |
temp.style.height = '200px'; | temp.style.height = '200px'; | ||
- | + | if($w.scrollTop() > Heat_Resistant_system) | |
- | + | ||
- | + | ||
temp.style.height = '250px'; | temp.style.height = '250px'; | ||
- | + | if($w.scrollTop() > des) | |
- | if ($('#mercury').height() > 100) { | + | temp.style.height = '275px'; |
+ | if($w.scrollTop() > si) | ||
+ | temp.style.height = '300px'; | ||
+ | if($w.scrollTop() > re) | ||
+ | temp.style.height = '325px'; | ||
+ | if($('#mercury').height() > 100) { | ||
$('.temp.tem37').animate({ | $('.temp.tem37').animate({ | ||
opacity: 1, | opacity: 1, | ||
Line 93: | Line 92: | ||
var modeling = $("#modeling").offset().top; | var modeling = $("#modeling").offset().top; | ||
var overview = $('#overview').offset().top - 110; | var overview = $('#overview').offset().top - 110; | ||
- | var Noise_in_the_cell = $("#Noise_in_the_cell").offset().top - 110; | + | var Noise_in_the_cell = $("#Noise_in_the_cell").offset().top - 110; |
- | + | ||
var Quorum_Control_system = $('#Quorum_Control_system').offset().top - 110; | var Quorum_Control_system = $('#Quorum_Control_system').offset().top - 110; | ||
- | + | var Heat_Resistant_system = $('#Heat_Resistant_system').offset().top - 110; | |
- | if($w.scrollTop() > | + | var re = $('#re').offset().top - 110; |
- | scrollToElement(' | + | if($w.scrollTop() > re) { |
+ | scrollToElement('re', 'normal', 115); | ||
return; | return; | ||
} | } | ||
if($w.scrollTop() > Heat_Resistant_system) { | if($w.scrollTop() > Heat_Resistant_system) { | ||
scrollToElement('Heat_Resistant_system', 'normal', 115); | scrollToElement('Heat_Resistant_system', 'normal', 115); | ||
+ | return; | ||
+ | } | ||
+ | if($w.scrollTop() > Quorum_Control_system) { | ||
+ | scrollToElement('Quorum_Control_system', 'normal', 115); | ||
return; | return; | ||
} | } | ||
Line 128: | Line 131: | ||
var modeling = $("#modeling").offset().top; | var modeling = $("#modeling").offset().top; | ||
var overview = $('#overview').offset().top - 110; | var overview = $('#overview').offset().top - 110; | ||
- | var Noise_in_the_cell = $("#Noise_in_the_cell").offset().top - 110; | + | var Noise_in_the_cell = $("#Noise_in_the_cell").offset().top - 110; |
- | + | ||
var Quorum_Control_system = $('#Quorum_Control_system').offset().top - 110; | var Quorum_Control_system = $('#Quorum_Control_system').offset().top - 110; | ||
- | + | var Heat_Resistant_system = $('#Heat_Resistant_system').offset().top - 110; | |
+ | var re = $('#re').offset().top - 110; | ||
if($w.scrollTop() < overview) { | if($w.scrollTop() < overview) { | ||
scrollToElement('overview', 'normal', 105); | scrollToElement('overview', 'normal', 105); | ||
Line 140: | Line 143: | ||
return; | return; | ||
} | } | ||
+ | if($w.scrollTop() < Quorum_Control_system) { | ||
+ | scrollToElement('Quorum_Control_system', 'normal', 105); | ||
+ | return; | ||
+ | } | ||
if($w.scrollTop() < Heat_Resistant_system) { | if($w.scrollTop() < Heat_Resistant_system) { | ||
scrollToElement('Heat_Resistant_system', 'normal', 105); | scrollToElement('Heat_Resistant_system', 'normal', 105); | ||
return; | return; | ||
} | } | ||
- | if($w.scrollTop() < | + | if($w.scrollTop() < re) { |
- | scrollToElement(' | + | scrollToElement('re', 'normal', 105); |
return; | return; | ||
- | } | + | } |
+ | |||
else { | else { | ||
scrollToElement('footer', 'normal', 110); | scrollToElement('footer', 'normal', 110); |
Latest revision as of 04:04, 28 September 2013
(function() {
var $w = $(window);
var modeling = $("#modeling").offset().top;
var overview = $('#overview').offset().top - 110;
var Noise_in_the_cell = $("#Noise_in_the_cell").offset().top - 110;
var Quorum_Control_system = $('#Quorum_Control_system').offset().top - 110; var qsd = $('#qsd').offset().top - 110; var rd = $('#rd').offset().top - 110; var pc = $('#pc').offset().top - 110; var Heat_Resistant_system = $('#Heat_Resistant_system').offset().top - 110; var des = $('#des').offset().top - 110; var si = $('#si').offset().top - 110; var re = $('#re').offset().top - 110;
var temp = document.getElementById("mercury");
$w.scroll(function() { if($w.scrollTop() > modeling)
temp.style.height = '0px';
if($w.scrollTop() > overview)
temp.style.height = '25px';
if($w.scrollTop() > Noise_in_the_cell) temp.style.height = '50px'; if($w.scrollTop() > Quorum_Control_system) temp.style.height = '75px'; if($w.scrollTop() > qsd) temp.style.height = '125px'; if($w.scrollTop() > rd) temp.style.height = '175px'; if($w.scrollTop() > pc) temp.style.height = '200px'; if($w.scrollTop() > Heat_Resistant_system) temp.style.height = '250px'; if($w.scrollTop() > des) temp.style.height = '275px'; if($w.scrollTop() > si) temp.style.height = '300px'; if($w.scrollTop() > re) temp.style.height = '325px'; if($('#mercury').height() > 100) { $('.temp.tem37').animate({ opacity: 1, }, { duration: 100, queue: false }); } else { $('.temp.tem37').animate({ opacity: 0, }, { duration: 100, queue: false }); };
if ($('#mercury').height() > 200) { $('.temp.tem40').animate({ opacity: 1, }, { duration: 100, queue: false }); } else { $('.temp.tem40').animate({ opacity: 0, }, { duration: 100, queue: false }); };
if ($('#mercury').height() > 300) { $('.temp.tem43').animate({ opacity: 1, }, { duration: 100, queue: false }); } else { $('.temp.tem43').animate({ opacity: 0, }, { duration: 100, queue: false }); }; });
})();
function flipup(){
var $w = $(window); var modeling = $("#modeling").offset().top; var overview = $('#overview').offset().top - 110; var Noise_in_the_cell = $("#Noise_in_the_cell").offset().top - 110; var Quorum_Control_system = $('#Quorum_Control_system').offset().top - 110; var Heat_Resistant_system = $('#Heat_Resistant_system').offset().top - 110; var re = $('#re').offset().top - 110; if($w.scrollTop() > re) { scrollToElement('re', 'normal', 115); return; } if($w.scrollTop() > Heat_Resistant_system) { scrollToElement('Heat_Resistant_system', 'normal', 115); return; } if($w.scrollTop() > Quorum_Control_system) { scrollToElement('Quorum_Control_system', 'normal', 115); return; } if($w.scrollTop() > Noise_in_the_cell) { scrollToElement('Noise_in_the_cell', 'normal', 115); return; } if($w.scrollTop() > overview) { scrollToElement('overview', 'normal', 115); return; } if($w.scrollTop() > modeling) { scrollToElement('modeling', 'normal', 115); return; } else { $("body,html").animate({ scrollTop:0 //让body的scrollTop等于pos的top,就实现了滚动 },1000); } }
function flipdown(){
var $w = $(window); var modeling = $("#modeling").offset().top; var overview = $('#overview').offset().top - 110; var Noise_in_the_cell = $("#Noise_in_the_cell").offset().top - 110; var Quorum_Control_system = $('#Quorum_Control_system').offset().top - 110; var Heat_Resistant_system = $('#Heat_Resistant_system').offset().top - 110; var re = $('#re').offset().top - 110; if($w.scrollTop() < overview) { scrollToElement('overview', 'normal', 105); return; } if($w.scrollTop() < Noise_in_the_cell) { scrollToElement('Noise_in_the_cell', 'normal', 105); return; } if($w.scrollTop() < Quorum_Control_system) { scrollToElement('Quorum_Control_system', 'normal', 105); return; } if($w.scrollTop() < Heat_Resistant_system) { scrollToElement('Heat_Resistant_system', 'normal', 105); return; } if($w.scrollTop() < re) { scrollToElement('re', 'normal', 105); return; } else { scrollToElement('footer', 'normal', 110); return; } }