Skip to content

Commit 515e433

Browse files
list item is highlighted when map marker is hovered
1 parent d425690 commit 515e433

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

assets/index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ $text-indent: 25px;
132132
border-top: $border;
133133
background: transparent url("/images/city-arrow.png") no-repeat right center;
134134

135-
&:hover {
135+
&:hover, &.highlight {
136136
background: {
137137
color: $green;
138138
image: url("/images/city-arrow-hover.png"), url("/images/green-gradient.png");

javascripts/google_map.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,18 @@ $(function(){
8888
});
8989

9090

91+
// Highlight a list item whenever the corresponding map marker is hovered.
92+
for (i in markers){
93+
google.maps.event.addListener(markers[i], 'mouseover', function() {
94+
this.setIcon(markerHover);
95+
links.eq(markers.indexOf(this)).addClass("highlight");
96+
});
97+
google.maps.event.addListener(markers[i], 'mouseout', function() {
98+
this.setIcon(markerImage);
99+
links.eq(markers.indexOf(this)).removeClass("highlight");
100+
});
101+
}
102+
103+
104+
91105
});

stylesheets/index.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ a {
9393
text-decoration: none;
9494
border-top: 1px solid #e0e0e0;
9595
background: transparent url("/images/city-arrow.png") no-repeat right center; }
96-
.wrapper .cities ul li a:hover {
96+
.wrapper .cities ul li a:hover, .wrapper .cities ul li a.highlight {
9797
background-color: #0fd482;
9898
background-image: url("/images/city-arrow-hover.png"), url("/images/green-gradient.png");
9999
background-repeat: no-repeat, repeat-x;

0 commit comments

Comments
 (0)