Dynamic content in Magnific popup from button in infobox attached to Google Maps marker -
i need load different content magnific-popup opens when clicking buttons inside infoboxes attached markers in google maps.
i plan list content in array outside magnificpopup function (see below) defines markers corresponding content. how call right content magnific-popup? target marker, button or infobox? ...and how?
window.google.maps.event.addlistener(infobox, "domready", function () { $('.open-popup').on('click', function () { $.magnificpopup.open({ items: { src: $('<div class="white-popup">dynamically created element</div>'), // dynamically created element type: 'inline' } }); }); }); a working example of @ here >> http://jsfiddle.net/asier_adq/jdwmm/4/
thanks in advance pointers.
solved! in case infoboxes key linking click marker. given var ib = new infobox();
then, inside function attaches infoboxes markers add new property 'num' 'ib' object , define each markers 'i' variable. ib.num = i;
then can use inside magnificpopup function call triggered marker's values have stored in array. markerdata[ib.num][7]
the new script:
window.google.maps.event.addlistener(ib, "domready", function () { $('.open-popup-photo').on('click', function () { $.magnificpopup.open({ items: { src: markerdata[ib.num][7] }, type: 'image' // default type }); }); });
Comments
Post a Comment