Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
window.onload = function() { | window.onload = function() { | ||
var teamElemList = document.getElementsByClassName("team-member"); | var teamElemList = document.getElementsByClassName("team-member"); | ||
− | |||
− | |||
− | |||
for(var i = 0;i < teamElemList.length;i ++) { | for(var i = 0;i < teamElemList.length;i ++) { | ||
− | |||
− | |||
− | |||
− | |||
− | |||
teamElemList[i].addEventListener("mouseover", changeImageOver); | teamElemList[i].addEventListener("mouseover", changeImageOver); | ||
teamElemList[i].addEventListener("mouseout", revertImageOut); | teamElemList[i].addEventListener("mouseout", revertImageOut); | ||
Line 45: | Line 15: | ||
function changeImageOver() { | function changeImageOver() { | ||
var teamElem = this; | var teamElem = this; | ||
− | var temp = teamElem. | + | teamElem.style.cursor = "pointer"; |
− | temp. | + | var temp = teamElem.getElementsByClassName(".member-img")[1]; |
+ | temp.style.zIndex = 2; | ||
temp.style.opacity = 0.4; | temp.style.opacity = 0.4; | ||
− | |||
− | |||
− | |||
temp = teamElem.querySelector(".member-intro"); | temp = teamElem.querySelector(".member-intro"); | ||
temp.style.display = "block"; | temp.style.display = "block"; | ||
temp.style.opacity = 1; | temp.style.opacity = 1; | ||
− | temp.style.transition = "opacity | + | temp.style.transition = "opacity 0.8s"; |
− | + | ||
} | } | ||
function revertImageOut() { | function revertImageOut() { | ||
var teamElem = this; | var teamElem = this; | ||
− | + | teamElem.style.cursor = "auto"; | |
− | + | var temp = teamElem.getElementsByClassName(".member-img")[1]; | |
− | + | temp.style.zIndex = -2; | |
− | temp = teamElem. | + | |
− | + | ||
− | + | ||
temp = teamElem.querySelector(".member-intro"); | temp = teamElem.querySelector(".member-intro"); | ||
− | + | temp.style.display = "none"; | |
− | temp.style.opacity = 0; | + | // temp.style.opacity = 0; |
− | temp.style.transition = "opacity 0s | + | // temp.style.transition = "opacity 0s"; |
− | + | ||
} | } | ||
function changeImageDown() { | function changeImageDown() { | ||
var teamElem = this; | var teamElem = this; | ||
− | var temp = teamElem. | + | teamElem.style.cursor = "auto"; |
− | temp. | + | var temp = teamElem.getElementsByClassName(".member-img")[2]; |
+ | temp.style.zIndex = 3; | ||
temp = teamElem.querySelector(".member-name"); | temp = teamElem.querySelector(".member-name"); | ||
temp.style.display = "none"; | temp.style.display = "none"; | ||
Line 81: | Line 45: | ||
temp = teamElem.querySelector(".member-cute"); | temp = teamElem.querySelector(".member-cute"); | ||
temp.style.display = "block"; | temp.style.display = "block"; | ||
− | |||
} | } | ||
function revertImageUp() { | function revertImageUp() { | ||
var teamElem = this; | var teamElem = this; | ||
− | var temp = teamElem. | + | teamElem.style.cursor = "pointer"; |
− | temp. | + | var temp = teamElem.getElementsByClassName(".member-img")[2]; |
+ | temp.style.zIndex = -3; | ||
temp.style.opacity = 0.4; | temp.style.opacity = 0.4; | ||
temp = teamElem.querySelector(".member-name"); | temp = teamElem.querySelector(".member-name"); | ||
Line 94: | Line 58: | ||
temp = teamElem.querySelector(".member-cute"); | temp = teamElem.querySelector(".member-cute"); | ||
temp.style.display = "none"; | temp.style.display = "none"; | ||
− | |||
} | } | ||
function displaySelectedGroup() { | function displaySelectedGroup() { |
Revision as of 11:41, 7 October 2017
window.onload = function() { var teamElemList = document.getElementsByClassName("team-member"); for(var i = 0;i < teamElemList.length;i ++) { teamElemList[i].addEventListener("mouseover", changeImageOver); teamElemList[i].addEventListener("mouseout", revertImageOut); teamElemList[i].addEventListener("mousedown", changeImageDown); teamElemList[i].addEventListener("mouseup", revertImageUp); } var group = document.querySelector(".group-list"); var groupList = group.children; for(var i =0;i < groupList.length;i ++) { groupList[i].addEventListener("click", displaySelectedGroup); } } function changeImageOver() { var teamElem = this; teamElem.style.cursor = "pointer"; var temp = teamElem.getElementsByClassName(".member-img")[1]; temp.style.zIndex = 2; temp.style.opacity = 0.4; temp = teamElem.querySelector(".member-intro"); temp.style.display = "block"; temp.style.opacity = 1; temp.style.transition = "opacity 0.8s"; } function revertImageOut() { var teamElem = this; teamElem.style.cursor = "auto"; var temp = teamElem.getElementsByClassName(".member-img")[1]; temp.style.zIndex = -2; temp = teamElem.querySelector(".member-intro"); temp.style.display = "none"; // temp.style.opacity = 0; // temp.style.transition = "opacity 0s"; } function changeImageDown() { var teamElem = this; teamElem.style.cursor = "auto"; var temp = teamElem.getElementsByClassName(".member-img")[2]; temp.style.zIndex = 3; temp = teamElem.querySelector(".member-name"); temp.style.display = "none"; temp = teamElem.querySelector(".member-intro"); temp.style.display = "none"; temp = teamElem.querySelector(".member-cute"); temp.style.display = "block"; } function revertImageUp() { var teamElem = this; teamElem.style.cursor = "pointer"; var temp = teamElem.getElementsByClassName(".member-img")[2]; temp.style.zIndex = -3; temp.style.opacity = 0.4; temp = teamElem.querySelector(".member-name"); temp.style.display = "block"; temp = teamElem.querySelector(".member-intro"); temp.style.display = "block"; temp = teamElem.querySelector(".member-cute"); temp.style.display = "none"; } function displaySelectedGroup() { var displayGroupName = this.getAttribute("data-group"); var team = document.querySelector(".team-row"); var teamList = team.children; if(displayGroupName == "all") { for(var i = 0;i < teamList.length;i ++) { teamList[i].style.display = "inline-block"; } } else { for(var i = 0;i < teamList.length;i ++) { teamList[i].style.display = "none"; } var displayGroups = team.getElementsByClassName(displayGroupName); for(var i = 0;i < displayGroups.length;i ++) { displayGroups[i].style.display = "inline-block"; } } }