Skip to content

Instantly share code, notes, and snippets.

@bacoords
Last active October 23, 2020 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bacoords/304ad0a735fbe6fc61971e1e1078afe0 to your computer and use it in GitHub Desktop.
Save bacoords/304ad0a735fbe6fc61971e1e1078afe0 to your computer and use it in GitHub Desktop.
Setting up function for 'onload' more properly
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