3

Is it possible to grab the labelClass of a markerwithlabel utility library object and then to rotate it using jquery rotate?

I've been trying something like this but cant get it to work...:

var markerx = new MarkerWithLabel({
        position: new google.maps.LatLng(0.0),
        draggable: false,
        raiseOnDrag: false,
        map: map,
        labelContent: "some chat",
        labelAnchor: new google.maps.Point(30, 20),
        labelClass: "labels", // the CSS class for the label
        labelStyle: {opacity: 1.0},
        icon: "/assets/swell_arrow.png",
        visible: true
       });
  $(document).ready(function()
        {
            $('.labels').rotate(30);
        }); 

Thanks for any input!

geocodezip
  • 158,664
  • 13
  • 220
  • 245
user1051849
  • 2,307
  • 5
  • 26
  • 43
  • maybe you can try to rotate an image using css [transform](http://stackoverflow.com/questions/11832131) – Timeless Apr 26 '13 at 03:50

1 Answers1

1

This is what I did:

var iconLabel = document.createElement("img");
    iconLabel.src = ImageFiles+"/icons/"+icn+"f.png";
    iconLabel.setAttribute("id","img"+$i);

var marker = new MarkerWithLabel({
    position: point,
    icon: Icons["blank"],
    shadow: Icons["blank"],
    draggable: false,
    map: theMap.map,
    flat: true,
    optimized: false,
    visible: true,
    labelContent: iconLabel , 
    labelAnchor: new google.maps.Point(16,16), 
    labelClass: "labels", 
    labelVisible: true,
    labelStyle: {opacity: 0.75}
});

Markers.length++;
Markers[$i] = marker;
Markers[$i].iLabel = iconLabel;

Then when I wanted to rotate:

var tID = Markers[theIDX].iLabel.getAttribute("id");
$("#"+tID).rotate(parseFloat(heading));

It rotates the labelContent attribute, not the Class.

--Sam

Sam Grant
  • 432
  • 2
  • 7
  • 19