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
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
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
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
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
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
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