Difference between revisions of "Team:SSTi-SZGD/js/Parts"

(Created page with "$(function(){ $(document).attr("title","Parts - Team:SSTi-SZGD - 2018.igem.org"); $(".page_nav ul li").removeClass("active"); $(".page_nav ul li").eq(2).addClass("activ...")
 
(final)
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
 
 
$(document).attr("title","Parts - Team:SSTi-SZGD - 2018.igem.org");
 
$(document).attr("title","Parts - Team:SSTi-SZGD - 2018.igem.org");
 +
 +
//add transition
 +
$(".page_content").addClass("transition");
 +
$(".page_content").find("*").addClass("transition");
 
 
 
$(".page_nav ul li").removeClass("active");
 
$(".page_nav ul li").removeClass("active");
Line 55: Line 59:
 
 
 
var Hpage_nav=$(".page_nav").outerHeight()+75;
 
var Hpage_nav=$(".page_nav").outerHeight()+75;
var oTop_Improved=$(".Improved_part").offset().top-Hpage_nav;
 
 
var oTop_All=$(".All_parts").offset().top-Hpage_nav;
 
var oTop_All=$(".All_parts").offset().top-Hpage_nav;
 
var oTop_Basic=$(".Basic_part").offset().top-Hpage_nav;
 
var oTop_Basic=$(".Basic_part").offset().top-Hpage_nav;
 
var oTop_Composite=$(".Composite_part").offset().top-Hpage_nav;
 
var oTop_Composite=$(".Composite_part").offset().top-Hpage_nav;
 +
var oTop_Improved=$(".Improved_part").offset().top-Hpage_nav;
 
var sTop=$(window).scrollTop();
 
var sTop=$(window).scrollTop();
if(sTop>=oTop_Composite){
+
if(sTop>=oTop_Improved){
 
$(".sub_nav li a").removeClass("active");
 
$(".sub_nav li a").removeClass("active");
 
$(".sub_nav li.Parts a").eq(3).addClass("active");
 
$(".sub_nav li.Parts a").eq(3).addClass("active");
}else if(sTop>=oTop_Basic){
+
}else if(sTop>=oTop_Composite){
 
$(".sub_nav li a").removeClass("active");
 
$(".sub_nav li a").removeClass("active");
 
$(".sub_nav li.Parts a").eq(2).addClass("active");
 
$(".sub_nav li.Parts a").eq(2).addClass("active");
}else if(sTop>=oTop_All){
+
}else if(sTop>=oTop_Basic){
 
$(".sub_nav li a").removeClass("active");
 
$(".sub_nav li a").removeClass("active");
 
$(".sub_nav li.Parts a").eq(1).addClass("active");
 
$(".sub_nav li.Parts a").eq(1).addClass("active");
}else if(sTop>=oTop_Improved){
+
}else if(sTop>=oTop_All){
 
$(".sub_nav li a").removeClass("active");
 
$(".sub_nav li a").removeClass("active");
 
$(".sub_nav li.Parts a").eq(0).addClass("active");
 
$(".sub_nav li.Parts a").eq(0).addClass("active");

Latest revision as of 14:22, 6 November 2018

$(function(){

$(document).attr("title","Parts - Team:SSTi-SZGD - 2018.igem.org");

//add transition $(".page_content").addClass("transition"); $(".page_content").find("*").addClass("transition");

$(".page_nav ul li").removeClass("active"); $(".page_nav ul li").eq(2).addClass("active");

if(window.location.search==""){ $(".page_title").text("Parts"); }else{ $(".page_title").text("部分"); }


if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry|iPad/i.test(navigator.userAgent)){

//Banner if($(window).width()<768){ $(".Banner").css({"height":"250px","background-size":"80%","margin":"50px 0 0 0"}); }else{ $(".Banner").css({"height":"500px","background-size":"70%","margin":"100px 0 0 0"}); } if(window.orientation=="-90"||window.orientation=="90"){ if($(window).width()<768){ $(".Banner").css({"height":"500px","background-size":"80%","margin":"50px 0 0 0"}); }else{ $(".Banner").css({"height":"500px","background-size":"60%","margin":"100px 0 0 0"}); } }

}

$(window).resize(function(){

if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry|iPad/i.test(navigator.userAgent)){

//Banner if($(window).width()<768){ $(".Banner").css({"height":"250px","background-size":"80%","margin":"50px 0 0 0"}); }else{ $(".Banner").css({"height":"500px","background-size":"70%","margin":"100px 0 0 0"}); } if(window.orientation=="-90"||window.orientation=="90"){ if($(window).width()<768){ $(".Banner").css({"height":"500px","background-size":"80%","margin":"50px 0 0 0"}); }else{ $(".Banner").css({"height":"500px","background-size":"60%","margin":"100px 0 0 0"}); } } }

});

$(window).scroll(function(){

var Hpage_nav=$(".page_nav").outerHeight()+75; var oTop_All=$(".All_parts").offset().top-Hpage_nav; var oTop_Basic=$(".Basic_part").offset().top-Hpage_nav; var oTop_Composite=$(".Composite_part").offset().top-Hpage_nav; var oTop_Improved=$(".Improved_part").offset().top-Hpage_nav; var sTop=$(window).scrollTop(); if(sTop>=oTop_Improved){ $(".sub_nav li a").removeClass("active"); $(".sub_nav li.Parts a").eq(3).addClass("active"); }else if(sTop>=oTop_Composite){ $(".sub_nav li a").removeClass("active"); $(".sub_nav li.Parts a").eq(2).addClass("active"); }else if(sTop>=oTop_Basic){ $(".sub_nav li a").removeClass("active"); $(".sub_nav li.Parts a").eq(1).addClass("active"); }else if(sTop>=oTop_All){ $(".sub_nav li a").removeClass("active"); $(".sub_nav li.Parts a").eq(0).addClass("active"); }else{ $(".sub_nav li a").removeClass("active"); }

});

});