Guest User

Untitled

a guest
Apr 26th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. marker.bindPopup(content).openPopup();
  2.  
  3. marker.updatePopup(newContent);
  4.  
  5. //marker creation
  6. var marker = L.marker([44.63, 22.65]).bindPopup('something').addTo(map);
  7. marker.openPopup();
  8.  
  9. //changing the content on mouseover
  10. marker.on('mouseover', function(){
  11. marker._popup.setContent('something else')
  12. });
  13.  
  14. $('button').click(function() {
  15. // Update the contents of the popup
  16. $(popup._contentNode).html('The new content is much longer so the popup should update how it looks.');
  17.  
  18. // Calling _updateLayout to the popup resizes to the new content
  19. popup._updateLayout();
  20.  
  21. // Calling _updatePosition so the popup is centered.
  22. popup._updatePosition();
  23. return false;
  24. });
Add Comment
Please, Sign In to add comment