Viewing 3 replies - 1 through 3 (of 3 total)
  • I was having the same issue and absolutely no answers in the events manager community but I finally came across a simple solution that won’t take much hard coding.
    If you open up events-manager.js (events-manager/includes/js/events-manager.js) find the snippet of code

    /* Load any maps */	
    
    	if( $('.em-location-map').length > 0 || $('.em-locations-map').length > 0 || $('#em-map').length > 0 ){
    
    		var script = document.createElement("script");
    
    		script.type = "text/javascript";
    
    		script.src = (EM.is_ssl) ? 'https://maps.google.com/maps/api/js?v=3.8&sensor=false&callback=em_maps':'http://maps.google.com/maps/api/js?v=3.4&sensor=false&callback=em_maps';
    
    		document.body.appendChild(script);
    
    	}

    Take this out of the ready function bracket and create a function out of it something like this:

    function loadScript() {
    
    		var script = document.createElement("script");
    
    		script.type = "text/javascript";
    
    		script.src = (EM.is_ssl) ? 'https://maps.google.com/maps/api/js?v=3.8&sensor=&callback=em_maps':'http://maps.google.com/maps/api/js?v=3.4&sensor=false&callback=em_maps';
    
    		document.body.appendChild(script);
    
    	}

    Then we are going to use this amazing function i found called ajaxSuccess. Inside the ready function call the loadscript function we just created like this:

    $(document).ajaxSuccess(function() {
      loadScript();
    });

    hope this helps.

    Thread Starter jeremejazz

    (@jeremejazz)

    Thank you for the help. I will try that when I am back to what I’m doing

    🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Events Manager] Map On Ajax Page Load’ is closed to new replies.