-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
44 lines (37 loc) · 1.22 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// set backgrounds in menu class to respective anchors
//makes the entire backfround clickable for the anchor
//
$(".menu .small").click(function() {
window.location = $(this).find("a").attr("href");
return false;
});
$(".menu .medium").click(function() {
window.location = $(this).find("a").attr("href");
return false;
});
$(".menu .large").click(function() {
window.location = $(this).find("a").attr("href");
return false;
});
$(".menu .giant").click(function() {
window.location = $(this).find("a").attr("href");
return false;
});
//function for mouseenter to show puppy picture
//and mouseleave to revert to adult picture
function switchPic(dogBreed) {
$("#"+dogBreed).mouseenter(function(){
$(this).attr("src","indexPics/"+dogBreed+"Puppy.jpg")
$(this).css('border-radius','20px')
})
$("#"+dogBreed).mouseleave(function(){
$(this).attr("src","indexPics/"+dogBreed+".jpg")
$(this).css('border-radius','20px')
})
}
//array of the breeds
var breeds=["dachshund", "beagle",'borderCollie',"boston", "bulldog","bullmastiff",
"doberman","german","golden","greatDane","greyhound","jackRussell",
"lab","newfoundland","pointer"]
//for each breed type in the breed array use switchPic
breeds.forEach(switchPic)