Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mjramer authored Oct 17, 2019
0 parents commit 2ab2d55
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 0 deletions.
12 changes: 12 additions & 0 deletions GalleryList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
mona_lisa = "MonaLisa.jpg";
starry_night = "StarryNight.jpg";
scream = "Scream.jpg";
guernica = "Guernica.jpg";
persistence_memory = "PersistenceMemory.jpg";

var GalleryList = new Array (
new Art("Mona Lisa", 830, mona_lisa, "0"),
new Art("Starry Night", 100, starry_night, "1"),
new Art("The Scream", 120, scream, "2"),
new Art("Guernica", 200, guernica, "3"),
new Art("The Persistence of Memory", 550, persistence_memory, "4"));
Binary file added Guernica.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MonaLisa.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PersistenceMemory.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Scream.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added StarryNight.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions art.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html>
<head>
<title>Works of Art</title>
<style type="text/css">
img {
border: 1px solid #ddd;
border-radius: 4px;
padding: 5px;
margin: 10px;
display: inline-block;
}
</style>
</head>

<script language="javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script language="javascript" src="artObject.js"></script>
<script language="javascript" src="GalleryList.js"></script>

<body>
<h2 style='padding:5px 5px;'>Homework 6 <br> Max Ramer <br> 10/22/19 <hr> </h2>
</body>

<script language="javascript">
buildGallery(GalleryList);
$(document).ready(function() {
for (i = 0; i < GalleryList.length; i++) {
$("#" + GalleryList[i].id).mouseenter(function() {
$("#preview").hide();
$("#preview").html("<img src='" + this.src + "' name='" + this.name + "Big' id='" + this.id + "' width='40%' height='40%'>");
$("#preview").fadeIn(300);
});
$(".galleryItem").click(function() {
$("#info").html("<h3 style='text-align:center'>Title: " + this.name + "<br> Price: $" + GalleryList[this.id].price + " million</h3>");
setTimeout(function() {
$("#info").html("&nbsp;");
},5000);

});
$("#" + GalleryList[i].id).mouseout(function() {
$("#preview").hide();
});
}
});
</script>

</html>
21 changes: 21 additions & 0 deletions artObject.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
function Art(name, price, src, id)
{
this.name = name;
this.price = price;
this.src = src;
this.id = id;
}

function getPrice()
{
return this.price;
}

function buildGallery(list)
{
document.write("<div id='info'>&nbsp;</div>");
for (i = 0; i < list.length; i++) {
document.write("<img src='" + list[i].src + "' name='" + list[i].name + "' id='" + list[i].id + "' class='galleryItem' width='10%' height='10%'>");
}
document.write("<div id='preview'>&nbsp;</div>");
}

0 comments on commit 2ab2d55

Please sign in to comment.