<g>
<rect id="jonesville" class="city-region" x="502.226" y="85.662" fill="#6794A1" width="110" height="30"/>
- <rect x="502.226" y="85.662" fill="none" stroke="#FFFFFF" stroke-width="1.0488" stroke-miterlimit="10" width="110" height="30"/>
+ <rect class="city-region" x="502.226" y="85.662" fill="none" stroke="#FFFFFF" stroke-width="1.0488" stroke-miterlimit="10" width="110" height="30"/>
</g>
</g>
<g class="city-region">
<script>
jQuery(function($){
- var map = $("#city-map");
- var city_region = $('.city-region');
- var text_paths = $(city_region).children('path');
+ let map = $("#city-map");
+ let city_region = $('.city-region');
+ let text_paths = $(city_region).children('path');
+ let red = '#ed5537';
+ let blue = '#6694a1';
+ let sibling_region;
+
+ // hover elements
text_paths.hover(function(){
-
let parent = $(this).parent();
- let sibling = parent.next();
-
+ let sibling = parent.prev();
+ sibling_region = sibling.children('g').find('rect');
+ sibling_region.css({"fill" :red, 'cursor' : 'pointer'});
},function(){
- console.log("out");
-
+ sibling_region.css("fill", blue);
});
city_region.hover(function(){
-// console.log($(this))
+ $(this).css({"fill" :red, 'cursor' : 'pointer'});
},function(){
-// console.log("out");
+ $(this).css("fill", blue);
});
+
});
</script>