Lazy Load Google Maps API with jQuery – Lazymap

A lightweight jQuery plugin to lazy / late load Google Maps API with custom API key, zoom arrange and location.

Plugin Overview

Plugin: lazymap
Author: Martino Gabrielli
Licence: MIT Licence
Published: March 1, 2024
Repository: Fork on GitHub
Dependencies: jQuery 1.3.1 or Latest version
File Type: zip archive (HTML, CSS & JavaScript)
Package Size: 3.68 KB

How to Use jQuery Lazy Load Google Maps’s Plugin:

1. To getting started with lazymap plugin, load the jQuery and lazymap JavaScript files into HTML document.

<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>

<!-- Lazy Load Google Map Js -->
<script src="jquery.lazymap.js"></script>

2. Create a container (a div element) in which the map will be loaded. Also define the zoom arrange and map’s latitude & longitude data with the following mentioned data attributes.

<div class="map" data-lat="41.898743" data-lng="12.498862" data-zoom="11"></div>

3. Initialize the plugin in jQuery document ready function with that div selector and insert your Google Map API key into it.

$(document).ready(function(){
     $('.map').lazymap({
            apiKey: '',
            culture: 'it'
     });
});

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About CodeHim

Free Web Design Code & Scripts - CodeHim is one of the BEST developer websites that provide web designers and developers with a simple way to preview and download a variety of free code & scripts. All codes published on CodeHim are open source, distributed under OSD-compliant license which grants all the rights to use, study, change and share the software in modified and unmodified form. Before publishing, we test and review each code snippet to avoid errors, but we cannot warrant the full correctness of all content. All trademarks, trade names, logos, and icons are the property of their respective owners... find out more...

Please Rel0ad/PressF5 this page if you can't click the download/preview link

X