Skip to content

Instantly share code, notes, and snippets.

@mAAdhaTTah
Created December 20, 2016 04:36
Show Gist options
  • Save mAAdhaTTah/f86351c82c49a05b142e0f91de2100d1 to your computer and use it in GitHub Desktop.
Save mAAdhaTTah/f86351c82c49a05b142e0f91de2100d1 to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=f86351c82c49a05b142e0f91de2100d1
<!DOCTYPE html>
<html>
<head>
<title>jQuery Fun House Starter Code</title>
</head>
<body>
<div class="section" id="gallery">
<h1>Pictures of elephants</h1>
<img class="gallery-thumb" id="pic1" src="https://upload.wikimedia.org/wikipedia/commons/f/f9/Loxodonta_africana_-_old_bull_(Ngorongoro,_2009).jpg">
<img class="gallery-thumb" id="pic2" src="https://upload.wikimedia.org/wikipedia/commons/6/63/African_elephant_warning_raised_trunk.jpg">
<img class="gallery-thumb" id="pic3" src="https://iso.500px.com/wp-content/uploads/2014/08/2048-5.jpg">
<img id="gallery-main" src="www.fake.com">
</div>
</body>
</html>
{"enabledLibraries":["jquery"]}
$("#pic1").click(function() {
$("#gallery-main").slideToggle(800, function() {
$("#gallery-main").attr("src", "https://upload.wikimedia.org/wikipedia/commons/f/f9/Loxodonta_africana_-_old_bull_(Ngorongoro,_2009).jpg");
$("#gallery-main").slideToggle(800);
});
});
$("#pic2").click(function(){
$("#gallery-main").slideToggle(800, function() {
$("#gallery-main").attr("src", "https://upload.wikimedia.org/wikipedia/commons/6/63/African_elephant_warning_raised_trunk.jpg");
$("#gallery-main").slideToggle(800);
});
});
$("#pic3").click(function() {
$("#gallery-main").slideToggle(800, function() {
$("#gallery-main").attr("src", "https://iso.500px.com/wp-content/uploads/2014/08/2048-5.jpg");
$("#gallery-main").slideToggle(800);
});
});
#gallery {
width: 50%;
margin-left: auto;
margin-right: auto;
}
.gallery-thumb {
display: block;
float: left;
padding: 5px;
box-sizing: border-box;
width: 33%;
}
#change-color {
width: 300px;
text-align: center;
display: block;
margin: 0 auto;
font-size: 3em;
}
.section {
padding: 1em 0;
border-bottom: 2px dashed gray;
}
h1, #submit-name {
font-size: 2em;
}
input {
font-size: 1em;
}
#greeting {
text-align: center;
font-size: 2em;
text-shadow: 3px 3px 3px gray;
}
#gallery-main {
width: 100%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment