Team:HIT-Harbin/js/main.js
From 2014.igem.org
(Difference between revisions)
Line 1: | Line 1: | ||
- | |||
function sideMenu(x){ | function sideMenu(x){ | ||
var arr=document.getElementsByName("rnav"); | var arr=document.getElementsByName("rnav"); | ||
Line 20: | Line 19: | ||
$(function(){ $("ul.rnav1").hide(); $(".rnav1").hover(function(){ $(this).find("ul").stop(true,true); $(this).find("ul").slideDown(); },function(){ $(this).find("ul").stop(true,true); $(this).find("ul").slideUp(); }); }) | $(function(){ $("ul.rnav1").hide(); $(".rnav1").hover(function(){ $(this).find("ul").stop(true,true); $(this).find("ul").slideDown(); },function(){ $(this).find("ul").stop(true,true); $(this).find("ul").slideUp(); }); }) | ||
}); | }); | ||
+ | |||
+ | |||
+ | $(document).ready(function() | ||
+ | { | ||
+ | |||
+ | |||
+ | var $top1= $('#minibar').offset().top + 20; | ||
+ | var $mid1 = Math.floor($(window).height() / 2); | ||
+ | |||
+ | $(window).scroll(function() | ||
+ | { | ||
+ | |||
+ | if ($(window).scrollTop()>$top1) | ||
+ | { | ||
+ | $('#nav').hide(); | ||
+ | $('#minibar').show(); | ||
+ | $('#minibar').addClass('nav'); | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | $('#minibar').hide(); | ||
+ | $('#nav').show(); | ||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | }); | ||
+ | |||
+ | }); |
Revision as of 05:34, 15 October 2014
function sideMenu(x){ var arr=document.getElementsByName("rnav"); var y=x-1; for(var i=0;i<6;i++){
if(i==y){ arr[i].style.display = "block";
}
else{ arr[i].style.display = "none";
} } }
$(document).ready(function(){
$(function(){ $("ul.nav1").hide(); $(".nav1").hover(function(){ $(this).find("ul").stop(true,true); $(this).find("ul").slideDown(); },function(){ $(this).find("ul").stop(true,true); $(this).find("ul").slideUp(); }); }) });
$(document).ready(function(){
$(function(){ $("ul.rnav1").hide(); $(".rnav1").hover(function(){ $(this).find("ul").stop(true,true); $(this).find("ul").slideDown(); },function(){ $(this).find("ul").stop(true,true); $(this).find("ul").slideUp(); }); }) });
$(document).ready(function()
{
var $top1= $('#minibar').offset().top + 20;
var $mid1 = Math.floor($(window).height() / 2);
$(window).scroll(function() {
if ($(window).scrollTop()>$top1) { $('#nav').hide(); $('#minibar').show(); $('#minibar').addClass('nav'); } else { $('#minibar').hide(); $('#nav').show();
}
});
});