A Pen by codebuilderspk on CodePen.
Created
January 15, 2020 10:47
-
-
Save hillbilly300/26d8f49dd23a41f9778d8c6f120bce68 to your computer and use it in GitHub Desktop.
amazon style image carousel for Nick
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
<!-- Nick Garren--> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
</head> | |
<body> | |
<div id="demo-content"> | |
<div id="product-view"> | |
<div class="preview-image"> | |
<div id="thumbnail-container"> | |
<img class="thumbnail focused" src="https://images.pexels.com/photos/90946/pexels-photo-90946.jpeg?auto=compress"> | |
<img class="thumbnail" src="https://images.pexels.com/photos/4158/apple-iphone-smartphone-desk.jpg?auto=compress"> | |
<img class="thumbnail" src="https://images.pexels.com/photos/5956/gift-brown-shopping-market.jpg?auto=compress"> | |
<img class="thumbnail" src="https://images.pexels.com/photos/264636/pexels-photo-264636.jpeg?auto=compress"> | |
</div> | |
<div id="preview-enlarged"> | |
<img src="https://images.pexels.com/photos/90946/pexels-photo-90946.jpeg?auto=compress"> | |
</div> | |
</div> | |
<div class="product-info"> | |
<div class="product-title">Lorem ipsum dolor sit amet consectetur - 4.8 </div> | |
<p>by <a href="#" class="link">3G Digital LLC</a></p> | |
<div class="rating"> | |
<a href="#"><i class="stars"></i></a> | |
<a href="#" class="link rating-count">1,020 ratings</a> | |
</div> | |
<hr> | |
<div class="description"> | |
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Facere aliquam a quam hic voluptate. Totam mollitia aliquam recusandae nisi eius. Aliquid deserunt enim maiores sequi corporis perferendis modi officiis atque. </p> | |
</div> | |
<div>300.00 USD</div> | |
</div> | |
</div> | |
</div> | |
<script src="https://code.jquery.com/jquery-3.2.1.js"></script> | |
<script> | |
$("#thumbnail-container img").hover(function() { | |
var src = $(this).attr("src"); | |
$("#preview-enlarged img").attr("src", src); | |
$('.thumbnail').removeClass('focused'); | |
$(this).addClass('focused'); | |
}); | |
</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; | |
margin: 0; | |
} | |
a, | |
button { | |
cursor: pointer; | |
text-decoration: none; | |
} | |
hr{ | |
background-color: transparent; | |
display: block; | |
height: 1px; | |
border-width: 0; | |
border-top: 1px solid #e7e7e7; | |
line-height: 19px; | |
margin-top: 0; | |
margin-bottom: 14px; | |
} | |
a.link { | |
color: #0066c0; | |
font-size: 13px; | |
} | |
a.link:hover { | |
color: #e77600; | |
} | |
.rating { | |
display: flex; | |
align-items: center; | |
padding:5px 0; | |
} | |
.rating-count { | |
margin-left: 10px; | |
} | |
.stars { | |
background-image: url(https://m.media-amazon.com/images/G/01/AUIClients/AmazonUIIcon-sprite_1x-003a05344e6a5263c945684c66748394b4cbb9a2._V2_.png); | |
background-position: -175px -368px; | |
width: 80px; | |
height: 18px; | |
background-size: 400px 900px; | |
background-repeat: no-repeat; | |
display: inline-block; | |
} | |
body { | |
font-family: Arial; | |
} | |
#gridview { | |
text-align: center; | |
} | |
div.image { | |
margin: 10px; | |
display: inline-block; | |
position: relative; | |
} | |
div.image img { | |
width: 100%; | |
max-width: 300px; | |
height: auto; | |
border: 1px solid #ccc; | |
} | |
div.preview-image { | |
float: left; | |
padding: 0 0 20px 20px; | |
width:50%; | |
max-width: 570px; | |
} | |
div.preview-image img { | |
width: 100%; | |
max-width: 450px; | |
height: auto; | |
border: 1px solid #ccc; | |
} | |
div.preview-image img.focused { | |
border: #fbb20f 2px solid; | |
} | |
div.image img:hover { | |
box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.32), 0 0 0 0px rgba(0, 0, 0, 0.16); | |
} | |
.heading { | |
padding: 10px 10px; | |
margin-bottom: 10px; | |
font-size: 1.2em; | |
} | |
#preview-enlarged { | |
padding: 0 10px; | |
} | |
#grid { | |
margin-bottom: 30px; | |
} | |
#product-view{ | |
width:65%; | |
} | |
.quick_look { | |
display: none; | |
position: absolute; | |
bottom: 20px; | |
left: 50%; | |
margin-left: -51px; | |
background: transparent; | |
border: #FFF 2px solid; | |
padding: 8px 25px; | |
color: #FFF; | |
font-size: 14px; | |
cursor: pointer; | |
} | |
.quick_look:hover { | |
background: #FFF; | |
color: #333; | |
} | |
.product-info { | |
width:50%; | |
padding: 0 30px 20px 20px; | |
line-height: 1.5; | |
} | |
div.product-info ul { | |
margin: 10px 0px; | |
padding: 0; | |
} | |
div.product-info li { | |
cursor: pointer; | |
list-style-type: none; | |
display: inline-block; | |
color: #F0F0F0; | |
text-shadow: 0 0 1px #666666; | |
font-size: 14px; | |
} | |
div.product-info .selected { | |
color: #e4a400; | |
text-shadow: 0 0 5px #ffb900; | |
} | |
.product-title { | |
font-size: 1.5em; | |
} | |
.product-category { | |
margin: 20px 0px; | |
font-size: 0.9em; | |
color: #c4c4c5; | |
text-transform: uppercase; | |
border-left: #c4c4c5 3px solid; | |
padding: 0px 5px 0px 5px; | |
text-transform: uppercase; | |
} | |
button.btn-info { | |
padding: 10px; | |
margin: 20px 20px 10px 0px; | |
padding: 10px 20px; | |
background: #67bdf7; | |
border: #60b2e8 1px solid; | |
border-radius: 3px; | |
color: #FFF; | |
} | |
.ui-widget-header { | |
border: none !important; | |
background: none !important; | |
} | |
#product-view { | |
border: #CCC 1px solid; | |
overflow: auto; | |
display: inline-block; | |
padding-top: 20px; | |
margin-top: 30px; | |
text-align: left; | |
} | |
div.preview-image img.thumbnail { | |
width: 50px; | |
margin-bottom: 10px; | |
padding: 5px; | |
} | |
#thumbnail-container { | |
width: 70px; | |
cursor: pointer; | |
} | |
.focused { | |
border: 1px solid #e77600 !important; | |
box-shadow: 0 0 3px 2px rgba(228, 121, 17, .5); | |
} | |
#product-view { | |
display: flex; | |
flex-direction: row; | |
} | |
.preview-image { | |
display: flex; | |
flex-direction: row; | |
} | |
/* Responsive Styles */ | |
@media screen and (min-width: 1224px) { | |
div.image { | |
width: 300px; | |
} | |
} | |
@media screen and (min-width: 1044px) and (max-width: 1224px) { | |
div.image { | |
width: 250px; | |
} | |
} | |
@media screen and (min-width: 845px) and (max-width: 1044px) { | |
div.image { | |
width: 200px; | |
} | |
} | |
@media screen and (max-width: 560px) { | |
#preview-enlarged { | |
float: none; | |
} | |
#thumbnail-container { | |
width: auto; | |
margin-top: 10px; | |
} | |
} | |
@media screen and (max-width:1080px) { | |
#product-view { | |
display: flex; | |
flex-direction: column; | |
} | |
.product-info { | |
width: 98%; | |
} | |
div.preview-image { | |
flex-direction: column-reverse; | |
width:98%; | |
} | |
#thumbnail-container { | |
display: flex; | |
padding: 10px 0; | |
} | |
#preview-enlarged { | |
padding:0; | |
} | |
} | |
@media screen and (max-width:768px) { | |
div.preview-image { | |
padding: 10px; | |
} | |
.product-info { | |
padding: 10px 0; | |
} | |
#product-view{ | |
width:100%; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment