Created
August 12, 2018 15:16
-
-
Save DynamiteC/61ff43b1ffa6a298f911dc060f37b041 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/xidotu
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
* { | |
box-sizing: border-box; | |
} | |
main { | |
padding: 30px; | |
min-width: 250px; | |
} | |
.hero { | |
height: 200px; | |
margin-bottom: 20px; | |
} | |
.hero img { | |
height: 100% | |
} | |
.thumbnail { | |
display: inline-block; | |
cursor: pointer; | |
height: 60px; | |
} | |
a.thumbnail:hover { | |
box-shadow: 5px 5px 5px gray; | |
} | |
.thumbnail img { | |
max-height: 100%; | |
} | |
</style> | |
</head> | |
<body> | |
<main> | |
<h1>Image Carousel</h1> | |
<div class="hero"> | |
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-65/cat1.jpg" alt="" /> | |
</div> | |
<div class="thumbnails"> | |
<a class="thumbnail"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-65/cat1.jpg" alt="" /></a> | |
<a class="thumbnail"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-65/cat2.jpg" alt="" /></a> | |
<a class="thumbnail"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-65/cat3.jpg" alt="" /></a> | |
<a class="thumbnail"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-65/cat4.jpg" alt="" /></a> | |
</div> | |
<script src="https://code.jquery.com/jquery-3.1.0.js"></script> | |
</main> | |
<script id="jsbin-javascript"> | |
// your code here | |
$(function (){ | |
$('.thumbnail').click(function(element) { | |
var src = $(element.currentTarget).find('img').attr('src'); | |
$('.hero img').attr('src', src); | |
}) | |
}); | |
</script> | |
<script id="jsbin-source-css" type="text/css">* { | |
box-sizing: border-box; | |
} | |
main { | |
padding: 30px; | |
min-width: 250px; | |
} | |
.hero { | |
height: 200px; | |
margin-bottom: 20px; | |
} | |
.hero img { | |
height: 100% | |
} | |
.thumbnail { | |
display: inline-block; | |
cursor: pointer; | |
height: 60px; | |
} | |
a.thumbnail:hover { | |
box-shadow: 5px 5px 5px gray; | |
} | |
.thumbnail img { | |
max-height: 100%; | |
}</script> | |
<script id="jsbin-source-javascript" type="text/javascript">// your code here | |
$(function (){ | |
$('.thumbnail').click(function(element) { | |
var src = $(element.currentTarget).find('img').attr('src'); | |
$('.hero img').attr('src', src); | |
}) | |
});</script></body> | |
</html> |
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
* { | |
box-sizing: border-box; | |
} | |
main { | |
padding: 30px; | |
min-width: 250px; | |
} | |
.hero { | |
height: 200px; | |
margin-bottom: 20px; | |
} | |
.hero img { | |
height: 100% | |
} | |
.thumbnail { | |
display: inline-block; | |
cursor: pointer; | |
height: 60px; | |
} | |
a.thumbnail:hover { | |
box-shadow: 5px 5px 5px gray; | |
} | |
.thumbnail img { | |
max-height: 100%; | |
} |
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
// your code here | |
$(function (){ | |
$('.thumbnail').click(function(element) { | |
var src = $(element.currentTarget).find('img').attr('src'); | |
$('.hero img').attr('src', src); | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment