Auto advance when click on Leaflet pop up? | XM Community
Skip to main content

I'm using Leaflet to show participants an interactive map with two markers:



integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin=""/>









This line of code from the code block above shows participants a pop up when they hover over marker 1:
marker1.bindPopup('
Number 1
$456K
2 bd | 2  ba | 1,008 sqft
 
');
My question: Can I auto advance to the next page when participants select the text in the pop up for marker 1? If not that, is it possible if they click on marker 1?
For additional clarification, the pop up for marker 1 contains an html table with both text and an image.

Add this to the mouseover event method:
this.getPopup()._contentNode.onclick = function () {
            document.querySelector("#NextButton").click();
        };


https://www.qualtrics.com/community/discussion/comment/34899#Comment_34899This worked perfectly! One follow-up question I have is about how I can record this event in my data file? More generally, I'd like to use the event for directing participants to subsequent pages.
For example, if they selected marker 1 I want to direct them to a marker 1 specific page (and so on).


There must be some identifying information in the marker.
You can then store it as an embedded variable.
See here for more details.


https://www.qualtrics.com/community/discussion/comment/34906#Comment_34906So for marker 1, it does have a unique latitude and longitude in the map:
[25.777085, -80.193935]
So, maybe I could use that? I went to the page you linked to but didn't immediately see what you were referring to.


There is a setEmbeddedData method defined over there.
You can use that to set the value of your embedded data.


https://www.qualtrics.com/community/discussion/comment/34899#Comment_34899Instead of having a popup tricker the next page, is it possible to have it trigger a question on the same page? That is, use in page display logic?


Leave a Reply