Last active
December 18, 2015 16:49
-
-
Save objectivehtml/5813663 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <a href="#" class="reveal" data-reveal-id="map-modal" id="reveal-trigger" style="display:none">Reveal</a> | |
| <div id="map-modal" class="reveal-modal"></div> | |
| {exp:gmap:init id="map" style="width:400px;height:300px"} | |
| {exp:channel:entries [YOUR PARAMS HERE]} | |
| {your_map_field id="map" data:url="/your/ajax/template/URL_TITLE" [YOUR RETINA ICON PARAMS HERE]} | |
| {/exp:channel:entries} | |
| <script type="text/javascript"> | |
| // This example assumes your map id is "map". | |
| // Loop through the global marker array | |
| $.each(map_markers, function(i, marker) { | |
| google.maps.event.addListener(marker, 'click', function() { | |
| var url = this.data.url; | |
| $.get(url, function(html) { | |
| $('#map-modal').html(html); | |
| $('#reveal-trigger').click(); | |
| }); | |
| }); | |
| }); | |
| </script> |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Two things to note on this examples. 1) the .reveal-modal div is empty. AJAX populates the content (obviously). 2) The easiest way to trigger a reveal is to use a click(), but since you don't need a button, it is set to hidden. This is an important thing to note.