I am using Leaflet to display a map where each marker's popup window has a javascript Flag inside of it (a vote flag so that user can vote up or down different locations). To accomplish this, I used Views PHP to create a PHP field with the following code: <?php print flag_create_link('vote', $row->nid); ?> (where 'vote' is the name of my flag). It works correctly except that the page refreshes after you click on the flag link. In the Flag module configuration it is set to use Javascript, and it works as Javascript outside the Leaflet modal popup.

Comments

nirad’s picture

I should add, I also have tried this using IP Geolocation Views & Maps using the Leaflet library and had the same issue.

nirad’s picture

This looks like it could provide the solution: http://stackoverflow.com/questions/13698975/click-link-inside-leaflet-po.... Now I have to figure out how I can implement it in Drupal...

levelos’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

I don't see an issue here.

jrcholtz’s picture

did anybody ever figure this out?

proweb.ua’s picture

in my module ds_field, i ad file ds_field.js with

(function ($, Drupal, window, document, undefined) {
    $(document).ready(function() {
        for (var i = 0; i < Drupal.settings.leaflet.length; i++) {
                var map = Drupal.settings.leaflet[i].lMap;

                map.on('popupopen', function() {
                    console.log("hello");
                    $('.fotorama').fotorama();
                });
            }
    });
})(jQuery, Drupal, this, this.document);