Last active
October 23, 2020 19:09
-
-
Save bacoords/304ad0a735fbe6fc61971e1e1078afe0 to your computer and use it in GitHub Desktop.
Setting up function for 'onload' more properly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addClickEvents() { | |
//events added here to ensure all image elements fully loaded prior to adding events | |
d3.select("#poster-image") //Extinction Rebellion | |
.on("mouseover", function() { showExcerpt("xr", 450, 125, "R", 500, 500, boxText); }) | |
.on("mouseout", function() {hideExcerpt("xr");}) | |
.on("click", showContrib); | |
d3.select("#blockUpperText3") //Robin Wall Kimmerer | |
.on("mouseover", function() { showExcerpt("rk", 450, 125, "T", 500, 500, boxText); }) | |
.on("mouseout", function() { hideExcerpt("rk"); }) | |
.on("click", showContrib); | |
d3.select("#blockUpperText") //la paperson | |
.on("mouseover", function() { showExcerpt("lp", 450, 125, "L", 500, 500, boxText); }) | |
.on("mouseout", function() { hideExcerpt("lp"); }) | |
.on("click", showContrib); | |
d3.select("#blockBottom2") //Tim Morton | |
.on("mouseover", function() { showExcerpt("tm", 450, 125, "B", 500, 500, boxText); }) | |
.on("mouseout", function() { hideExcerpt("tm"); }) | |
.on("click", showContrib); | |
d3.select("#textGreta") //Greta Thunberg/1975 | |
.on("mouseover", function() { showExcerpt("gt", 450, 125, "R", 500, 500, boxText); }) | |
.on("mouseout", function() { hideExcerpt("gt"); }) | |
.on("click", showContrib); | |
} | |
document.addEventListener('DOMContentLoaded', addClickEvents ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment