javascript - Change marker's labelClass on mouseover using jQuery on Google Maps -
i've added markerwithlabel.js file , can show markers labels on google map code:
markerarray[i] = new markerwithlabel({ position: mylatlng, map: map, icon: image, labelanchor: new google.maps.point(25, 30), labelclass: "marker_labels", // css class label labelstyle: {opacity: 0.75}, labelcontent: format_num(property[6]), } );
i want change class of label highlight when mouseover element on page corresponds marker/label. i've tried jquery can't working:
$(".sidelisting").hover( function () { $(markerarray[this.id].labelclass).addclass("hovered"); }, function () { $(markerarray[this.id].labelclass).removeclass("hovered"); } );
the above code doesn't show javascript errors in console nothing happens on mouseover, changing labelclass
label
doesn't work either, ideas?
first using this.id in hover function. work elements class sidelisting
have have ids match indexes of markerarray.
secondly: if markerarray[this.id].labelclass
isn't undefined, "marker_labels" , not domnode. makes $(markerarray[this.id].labelclass)
create either empty jquery object or jquery object refers element id "marker_labels". have call set on marker change property:
$(".sidelisting").hover( function () { markerarray[this.id].set("labelclass", "marker_labels hovered") }, function () { markerarray[this.id].set("labelclass", "marker_labels") } );
Comments
Post a Comment