Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: jQuery(...).gmap3 is not a function #17

Open
sadhana-homesfy opened this issue Aug 1, 2016 · 2 comments
Open

TypeError: jQuery(...).gmap3 is not a function #17

sadhana-homesfy opened this issue Aug 1, 2016 · 2 comments

Comments

@sadhana-homesfy
Copy link

No description provided.

@mlewis-everley
Copy link
Member

Hi Sadhana

Could you provide a little more detail?

Is this happening in the CMS or via the front end of the site?

What version of SS? What other modules do you have installed?

As a summary glance, it looks like you may not be loading jquery before the google maps JS loads?

@ihor-lev
Copy link

ihor-lev commented Nov 16, 2020

Hi from 2020 :)

I just had a similar issue when I had to use a custom CMS for the website. It worked well for some time but started failing after some CMS changes. I realized that $.gmap3 became undefined. That's why the whole map was not rendered.

I managed to fix that with a manually controlled script loading.

<script>
    const loadJS = function (url, container, onLoadFn){
        const scriptTag = document.createElement('script');
        scriptTag.src = url;
        scriptTag.onload = onLoadFn;
        scriptTag.onreadystatechange = onLoadFn;

        container.appendChild(scriptTag);
    };

    $(document).ready(function() {
        loadJS('https://cdn.jsdelivr.net/gmap3/7.2.0/gmap3.min.js', document.body, function () {
            MyMap.init('.map-container');
        });
    });
</script>

I'm sure, it's not perfect. But in my situation with limited access to CMS functionality, this is quite good enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants