WordPress.org

Forums

Pronamic Google Maps
[resolved] Trigger markers click event externally (4 posts)

  1. JamesBates
    Member
    Posted 1 year ago #

    Is there a way to trigger the click event on each marker externally using jQuery/JavaScript?
    Do the markers have an ID or Class I can access, or can I add one?
    Thanks, James

    https://wordpress.org/plugins/pronamic-google-maps/

  2. Leon Rowland
    Member
    Posted 1 year ago #

    Hello JamesBates.

    Only on single maps and not mashups. On single maps you can get the marker from the data attribute on .pgm element. The data key is google-maps-marker.

    To attach listeners to that marker you will have to look at the Google Maps JS documentation. That can be found here:

    https://developers.google.com/maps/documentation/javascript/events

    Hope that helps you!

  3. JamesBates
    Member
    Posted 1 year ago #

    Hello Leon,

    Thanks for the quick reply and this plugin is great by the way!

    I have tried using their documentation.

    The problem is I cant access markers that have already been created by pgm.

    There is no get current markers as far as I can see. In all of their examples the markers are created in same script that accessed them for further manipulation.

    Thanks, James

  4. Remco Tolsma
    Member
    Plugin Author

    Posted 1 year ago #

    @JamesBates that's correct, the markers created by our plugin are not accesible.

    https://github.com/pronamic/wp-pronamic-google-maps/blob/2.2.8/js/site.js#L119

    If you want you can always fork the Pronamic Google Maps plugin on GitHub and do a merge request with the feature you need.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Pronamic Google Maps
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic