Difference between revisions of "Template:SJTU-Software/teamJs"

 
Line 3: Line 3:
 
$("html").niceScroll();     
 
$("html").niceScroll();     
 
$('.membersNav').click(changePage);
 
$('.membersNav').click(changePage);
        $('.scrollNav').click(scrollToA);
+
$('img').click(show);
 +
$('.colorful').click(hide)
 
});
 
});
 
var changePage = function(){
 
var changePage = function(){
Line 15: Line 16:
 
}
 
}
  
var scrollToA = function(){
+
var show = function(){
var target = $(this).attr("href");
+
var target = $(this).attr("id");
target = $(target);
+
target = "#"+target+"2";
if (target.length){
+
$(target).css("width","100%");
$('html,body').animate({
+
$(target).css("-webkit-transform","rotate(360deg)");
scrollTop: target.offset().top
+
$(target).css("display","block")
},600)
+
}
}
+
 
 +
var hide = function(){
 +
$(this).css("width","0");
 +
 
}
 
}

Latest revision as of 11:03, 18 September 2015

$(document).ready(function(){ $(".fixed-nav").css("top",$(window).height()*0.3); $("html").niceScroll(); $('.membersNav').click(changePage); $('img').click(show); $('.colorful').click(hide) }); var changePage = function(){ var active = $(this).attr("id"); var bros = $(this).siblings(); $("."+active).css("display","inline"); bros.each(function(){ active = $(this).attr("id"); $("."+active).css("display","none"); }) }

var show = function(){ var target = $(this).attr("id"); target = "#"+target+"2"; $(target).css("width","100%"); $(target).css("-webkit-transform","rotate(360deg)"); $(target).css("display","block") }

var hide = function(){ $(this).css("width","0");

}