Unfortunately there is no automatic and out-of-the-box solution that I know of that would copy all content (markers, vectors, etc.) on adjacent copies of the world in Leaflet.
The easiest trick as proposed by Tomislav would be to manually generate extra copies of your content, offset by multiples of 360 degrees longitude. I think the continuousWorld
tileLayer option must be left at false
for that. In conjunction with worldCopyJump
map option, you could achieve the desired effect, at the expense of having to clone your content several times.
That being said, this may be just 1 possible solution for your objective, which you have not really explicited?
If you want to avoid the user from seeing an empty world, maybe you could simply not show the adjacent copies of the world. You have several ways of achieving that, and you can use them in conjunction:
Demo: http://jsfiddle.net/ve2huzxw/20/
Note: if minZoom
is set high enough, the use of worldCopyJump
map option renders a very similar effect as in Google Maps, i.e. you think you are rolling all around the world and find your content again. It is just that you never have a chance to see the exact same location twice on the same screen, and that the map automatically rolls back 360 degrees to remain on the content. This is still noticeable at the -180 / +180 degrees longitude border, as you have either content on the left or on the right, but never both simultaneously.
Demo: http://jsfiddle.net/ve2huzxw/21/