Biomod/2014/NTU/Templates/js/slidejs

From OpenWetWare

Jump to: navigation, search

$(document).ready(function(){ $('.subMenu li ').bind('mouseover',opensubmenu); $('.subMenu li ').bind('mouseout',closesubmenu);

myOffset=$('.subMenu').height(); stickyTop=$('.subMenu').offset().top; var scrollTop=$(window).scrollTop()+myOffset; $(window).scroll(function(){ var scrollTop=$(window).scrollTop()+myOffset; if(scrollTop>stickyTop+myOffset){ $('#fakesubMenu').css("height","70px") $('.subMenu').css({'position':'fixed','top':0,'left':0,'box-shadow': '0px 5px 10px #888888'}) } else{ $('#fakesubMenu').css("height","0px") $('.subMenu').css({'position':'relative','box-shadow': }) } });


$('.start').click(function(){ $("html body").animate({ scrollTop: $('.subMenu').offset().top },1000)

});

function opensubmenu() { $(this).find('ul').css('visibility','visible'); $(this).find('ul>li').css('visibility','visible'); $(this).find('ul>li>a').css('visibility','visible'); };

function closesubmenu() { $(this).find('ul').css('visibility','hidden'); $(this).find('ul>li').css('visibility','hidden'); $(this).find('ul>li>a').css('visibility','hidden'); };

$('#lefticon').click(transl); $('#righticon').click(transr); var count=0;

function transl(){ if(count>0){ $('#longblock').animate({left: '+=1012px'},500); count--; } } function transr(){ if(count<3){ $('#longblock').animate({left: '-=1012px'},500); count++; } }

})

Personal tools