Google Map Marker callback after available in DOM
up vote
-1
down vote
favorite
After
map = new google.maps.Map(...);
marker = new google.maps.Marker(
position: ...,
map: map,
title: 'marker',
)
If I immediately execute this, it return 0:
console.log('Marker found: ', $('[title=marker]').length);
Of course, if I delay 250ms, it is found:
setTimeout(function() console.log('Marker found: ', $('[title=marker]').length) , 250);
So I dont want to use timeout. Is there any marker drawn callback? I've tried this but not working:
google.maps.event.addListener(map, "idle", function()
console.log('Marker found: ', $('[title=marker]').length);
);
google.maps.event.addListener(marker, "idle", function()
console.log('Marker found: ', $('[title=marker]').length);
);
google-maps google-maps-markers
add a comment |
up vote
-1
down vote
favorite
After
map = new google.maps.Map(...);
marker = new google.maps.Marker(
position: ...,
map: map,
title: 'marker',
)
If I immediately execute this, it return 0:
console.log('Marker found: ', $('[title=marker]').length);
Of course, if I delay 250ms, it is found:
setTimeout(function() console.log('Marker found: ', $('[title=marker]').length) , 250);
So I dont want to use timeout. Is there any marker drawn callback? I've tried this but not working:
google.maps.event.addListener(map, "idle", function()
console.log('Marker found: ', $('[title=marker]').length);
);
google.maps.event.addListener(marker, "idle", function()
console.log('Marker found: ', $('[title=marker]').length);
);
google-maps google-maps-markers
1
Use asetTimeout
with a value of0
and/or ensure your map code is executing after the document has fully loaded. You could also detail what it is you're trying to do with the DOM elements for the markers. There's likely a better solution.
– André Dion
Nov 10 at 13:29
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
After
map = new google.maps.Map(...);
marker = new google.maps.Marker(
position: ...,
map: map,
title: 'marker',
)
If I immediately execute this, it return 0:
console.log('Marker found: ', $('[title=marker]').length);
Of course, if I delay 250ms, it is found:
setTimeout(function() console.log('Marker found: ', $('[title=marker]').length) , 250);
So I dont want to use timeout. Is there any marker drawn callback? I've tried this but not working:
google.maps.event.addListener(map, "idle", function()
console.log('Marker found: ', $('[title=marker]').length);
);
google.maps.event.addListener(marker, "idle", function()
console.log('Marker found: ', $('[title=marker]').length);
);
google-maps google-maps-markers
After
map = new google.maps.Map(...);
marker = new google.maps.Marker(
position: ...,
map: map,
title: 'marker',
)
If I immediately execute this, it return 0:
console.log('Marker found: ', $('[title=marker]').length);
Of course, if I delay 250ms, it is found:
setTimeout(function() console.log('Marker found: ', $('[title=marker]').length) , 250);
So I dont want to use timeout. Is there any marker drawn callback? I've tried this but not working:
google.maps.event.addListener(map, "idle", function()
console.log('Marker found: ', $('[title=marker]').length);
);
google.maps.event.addListener(marker, "idle", function()
console.log('Marker found: ', $('[title=marker]').length);
);
google-maps google-maps-markers
google-maps google-maps-markers
asked Nov 10 at 12:09
Coisox
5381512
5381512
1
Use asetTimeout
with a value of0
and/or ensure your map code is executing after the document has fully loaded. You could also detail what it is you're trying to do with the DOM elements for the markers. There's likely a better solution.
– André Dion
Nov 10 at 13:29
add a comment |
1
Use asetTimeout
with a value of0
and/or ensure your map code is executing after the document has fully loaded. You could also detail what it is you're trying to do with the DOM elements for the markers. There's likely a better solution.
– André Dion
Nov 10 at 13:29
1
1
Use a
setTimeout
with a value of 0
and/or ensure your map code is executing after the document has fully loaded. You could also detail what it is you're trying to do with the DOM elements for the markers. There's likely a better solution.– André Dion
Nov 10 at 13:29
Use a
setTimeout
with a value of 0
and/or ensure your map code is executing after the document has fully loaded. You could also detail what it is you're trying to do with the DOM elements for the markers. There's likely a better solution.– André Dion
Nov 10 at 13:29
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53238804%2fgoogle-map-marker-callback-after-available-in-dom%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Use a
setTimeout
with a value of0
and/or ensure your map code is executing after the document has fully loaded. You could also detail what it is you're trying to do with the DOM elements for the markers. There's likely a better solution.– André Dion
Nov 10 at 13:29