0

ok. what i want is the following: i want to control a mouseover of a marker with jquery.

how can i do that? i have no experience with pure js. (and i don't want to use a jquery-plugin)

i tried this:

google.maps.event.addListener(marker, 'ggmouseover', function() {
            marker.setIcon(pinred);
        });

        ggmouseover.mouseover();

this does not work. (it works with 'mouseover' instead of 'ggmouseover') i want to create a function or something i can call later through jquery. like: $('#button').mouseover(function(){ ggmouseover(); });

how can i do this? ideas?

1 Answer 1

4

You can do it by using :

trigger(instance:Object, eventName:string, var_args:*)

Triggers the given event. All arguments after eventName are passed as arguments to the listeners.

Which gives, for your case :

google.maps.event.addListener(marker, 'mouseover', function() {
    marker.setIcon(pinred);
});

$("#button").mouseover(function() {
    google.maps.event.trigger(marker, 'mouseover');
});
Sign up to request clarification or add additional context in comments.

1 Comment

Can I also write 'somethingelse' instead of 'mouseover' so that the mouseover only happens with the jquery-button?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.