Dominic Leonard
Dominic Leonard

Reputation: 31

Google Map pointers on click open jQuery Mobile panel weidget

I hope someone is able to help with this.

Essentially what i'm after is if a user clicks a map pointer (using Google Maps) then it opens up a panel widget in association with jQuery Mobile.

This is a snippet of the code for default linking. But this doesn't work.

google.maps.event.addListener(marker, 'click', function() {
     window.location.href = '#test';
});

Anyone have any ideas?

Upvotes: 1

Views: 107

Answers (1)

Omar
Omar

Reputation: 31732

Instead of window.location.href = '#test'; use .panel() method to open panel.

Open panel by its' ID, either an internal or external panel.

$("#panel-ID").panel("open");

Or, open panel within active page without ID.

$.mobile.pageContainer.pagecontainer("getActivePage").find("[data-role=panel]").panel("open");

Upvotes: 2

Related Questions