JQuery Map Highlight + Javascript Toggle ( ? ) & Dynamic Wordpress Content

Discussion in 'JavaScript' started by Trevor M.Rose, Feb 21, 2013.

  1. #1
    Hey guys, I've currently got a project going on where I'm using the JQuery Map Highlight Plugin ( by David Lynch:http://davidlynch.org/blog/2013/01/maphilight-for-jquery-1_9_0/ ) to create an outline effect on all counties in North Carolina when they are hovered. I've got two fairly big next steps that I'm not completely sure how to accomplish.

    I want to make it where if a user click on a county, a box appears below the map containing election results. Would I use the javascript toggle function here maybe? I have no idea.

    That box that's popping up under the map will be holding information from a custom post type through the backend of wordpress. What's the best way of targeting each county with in this box? Thanks guys!
     
    Trevor M.Rose, Feb 21, 2013 IP
  2. DmitryS

    DmitryS Active Member

    Messages:
    79
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #2
    Yes, you can use JavaScript to show the hidden content or use AJAX to load content when clicked.
    See like JS used for the interactive map of the U.S.
    http://www.fla-shop.com/products/html5/united-states/us/samples/
    Try clicking on the green states.
    It uses code like the following
    javascript:set_text('div1');
    Code (markup):
    and
    <SCRIPT>
    function set_text(div_name)
    {
    document.getElementById('main_text').innerHTML=document.getElementById(div_name).innerHTML
    }
    </SCRIPT>
    Code (markup):
     
    DmitryS, Feb 23, 2013 IP
  3. Trevor M.Rose

    Trevor M.Rose Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #3
    Thanks Dmitrys,
    Where you are placing a div name inside the function - is that for the class name of the maps county, or the class name of the text layer that is initially hidden until selected?
     
    Trevor M.Rose, Feb 25, 2013 IP