• Resolved pdsmatt

    (@pdsmatt)


    Hey there!

    A map we had on the front page isn’t loading when I have the JS optimized. I have excluded the js files below and combinations with the other JS optimize buttons in that box. I even talked with our host (WP Engine) and they can’t seem to find the issue. It pulls up a 404 error even though the files are there.

    Live site with JS Opt disabled:
    PremierDisability.com

    Dev site with JS Opt enabled:
    https://pdsreview.wpengine.com/

    Exclude scripts from Autoptimize:
    jquery.vmap.usa.js, jquery.vmap.js, jquery.vmap.min.js, jquery.vmap.packed.js, jqvmap.css

    And if it helps this is the line of code on our page-home.php that’s adding that section in.

    			<script type="text/javascript">
                jQuery(document).ready(function() {
                    var links = {
                        <?php
                        if($children){
                            foreach($children as $child){
                                echo strtolower(get_field('state_short_code',$child->ID)) . ":'".get_permalink($child->ID)."',";
                            }
                        }
                        ?>
                    };
                    jQuery('#vmap').vectorMap({
                        map: 'usa_en',
    					borderColor: '#ffffff',
    					color: '#cfcfcf',
    					backgroundColor: '#ffffff',
    					borderWidth: 3,
    					enableZoom: true,
                        showTooltip: true,
                        hoverColor: false,
                        onRegionClick: function(event, code, region){
                            event.preventDefault();
                            window.location =links[code];
                        }
                    });
                });
                </script>
                <!--<![endif]-->
    

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey @pdsmatt, I see you asked this on Stacexchange as well. Seems to me that you need to exclude jQuery from autoptimization as well because you are excluding some scripts that require it (jquery.vmap.usa.js, jquery.vmap.js, jquery.vmap.min.js, jquery.vmap.packed.js, jqvmap.css ) and if jQuery is autoptimized, it will be enqueued AFTER the scripts that need it to run.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    thanks @celsobessa ??

    Thread Starter pdsmatt

    (@pdsmatt)

    Yup, that worked! It’s now running just fine. Thanks for your help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Map not displaying’ is closed to new replies.