adding jquery to set default data for the dropdown display next to the community map
authorAnthony Talarico <talarico@gaslightmedia.com>
Thu, 11 Aug 2016 19:03:50 +0000 (15:03 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Thu, 11 Aug 2016 19:03:50 +0000 (15:03 -0400)
parts/community-map.php

index 565511b..761287e 100644 (file)
@@ -6,8 +6,8 @@
                  <?php get_template_part('parts/community-map-svg'); ?>
             </div>
             <div id="mapRegionData">
-            <?php $community_page_object = get_page( 155); ?>
-           <?php  $community_page_image = wp_get_attachment_url( get_post_thumbnail_id(155)); ?>
+            <?php $community_page_object = get_page( 155 ); ?>
+           <?php  $community_page_image = wp_get_attachment_url( get_post_thumbnail_id( 155 )); ?>
             <?php $community_page_content = json_encode(substr(strip_tags($community_page_object->post_content),0, 300)); ?>
                 <div class="map-image-container">
                 </div>
@@ -72,11 +72,18 @@ foreach ($nav_posts as $p){
         var community_link = $("#interactive-map");
         var default_content = <?php echo $community_page_content ?>;
        
-        $(community_link).find(".dropdown").mouseleave( function () {
+        // set the default data next to the dropdown community map
+        function set_default_data(){
             regionData.find(".map-page-title").html('<?php echo $community_page_object->post_title; ?>');
             regionData.find(".map-image-container").css("height","200px").css("width", "250px").css("background", "url('   <?php echo $community_page_image; ?>  ')no-repeat center center").css("background-position", "cover");
             regionData.find(".map-page-content").html(default_content);
-           
+        }
+        
+        $(community_link).find("li").mouseenter( function () {
+           set_default_data(); 
+        });
+        $(community_link).find(".dropdown").mouseleave( function () {
+            set_default_data();
         });
         
         // hover effects and data collection