Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm trying to make an application with google maps API. I want a function to be called when the user goes into street view. How would I create an event handler for when the street view is initiated?
First of all you should really go into the documentation before asking this question. Anyway, if you pay attention to the StreetViewPanorama class doc you will find something like
visible_changed
Arguments: None
This event is fired when the panorama's visibility changes. The
visibility is changed when the Pegman is dragged onto the map, the
close button is clicked, or setVisible() is called.
So probably using something like
var your_panorama = map.getStreetView()
you can then add a listener to the 'visible_changed' event. Calling the getVisible() method on your panorama should also help detect if you are actually in streetView mode. From there you can have your app behave accordingly. Play around with it and I am sure you'll be able to attain what you want.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 10 months ago.
Improve this question
I'm trying to understang how events, capturing and bubbling work. And there's some thing that is a bit unclear to me. Where an event is generated? In other words where an event starts going to the target element from? Some articles say events are created by window and then are propagated to document and so on. And some other say events are created in document. The javascript info website has an image where window is included so it makes me think that it is the window that generates events. But document has a .createdEvent method...
Using the document object, we can manipulate the content of the html document (DOM) - add events to elements. With the help of the window object, we can manage windows - it is higher in the hierarchy above the document, so all user events pass through it first.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
So from my understanding of event listeners is that the action only applies to the element that you used the event listener on.
But say that I wanted to listen for a click on one element that is in a separate div, but the element I want to apply certain actions on is in a separate div. What would be the best way if possible in doing so?
To help visualize, im looking at this users example.
https://ryannathanwilson.github.io/Rock_Paper_Scissors/
And so from what it looks like it listens for a click on any of the buttons, and then the clicked button shows up in another area and then performs a specific action. Is this possible? Or am I understanding his code incorrectly and the elements that appear at the bottom when clicked is the original element?
You can write a function like this:
function myfunc(){
document.getElementById("abcd").value = "Lorem Ipsum";
}
And call this function on the element you want to listen on:
<button onclick=myfunc()>Click me! </button>
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have a Google map with different markers and the markers are shown if the user with the lat and lng are online.
So but now I want that if a user goes offline or online that his marker appears/disappears from the map. The On/Off function is handled with firestore.
So I know when a user goes on/off and it works with a page reload, but how can I handle it without a page reload.
If you need some code let me know!
Thanks.
Create a timer in your javascript code that auto refreshes your collection of markers. Upon refreshing go through your collection of markers that you kept from your first creation and mark them as visible or not visible.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
After searching for a few hours I could not find the answer I seek, so am submitting a question here.
How would I add on/click popup windows into existing map: http://erichsen-group.com/demoland/vectormaps/vancouver/Vancouver%20Map.html?
An example of the functions and look I am after: http://www.discoverlosangeles.com/
I am not sure which ones you are referring to... but you should use on click listeners
Check out the link below:
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener
The whole idea is that you bind a listener to certain events and when they occur, you fire off some other method. So, if you have a div with some data in it, you can have it reposition to the point of the click, take in some input data and appear. Once the click is lifted or leaves an area (also a listener ;) you can hide the div again.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Is someone know a online Google Map "LatLng" generator that can give all "LatLng" when i click and save my multiple clicks "Latlng" that i can copy.
Please help me.
I'm not sure if I understand correctly what you are looking for, but when you mean that you are looking for a way to collect the LatLng's for clicks on a map you only have to observe the click-event of the map and store the latLng-property of the click-event somewhere(e.g. in a element in the page where you can select and copy it).
Sample: http://jsfiddle.net/doktormolle/JM8H8/
Without more details, the first answer which comes to my mind is : It is impossible to get all latitude / longitude of the world. It's like if you tried to get position of all points on the Earth, that makes no sens.
If you want to test your application with a lot of markers, just generates random coordinates (in a for loop for example), then, do what you want with these coordinates.