www.webdeveloper.com
Results 1 to 4 of 4

Thread: Help with relative % image maps?

Hybrid View

  1. #1
    Join Date
    Mar 2014
    Posts
    2

    Exclamation Help with relative % image maps?

    So, I'm pretty new and please excuse any silly questions.
    I have my image that is set to a width of 93% to accommodate all screen resolutions. Said image needs to have hotspot map links on it to navigate the user to other parts of the webpage.

    The issue I am running into is that, when the image scales according to a specific viewers screen resolution, the hotspots do not respond / follow / adjust. They are moved to other parts of the image and make no sense. Some google searching revealed that I need to set my image into a fixed position via pixels and not percents. How can I accommodate all screen resolutions that way? More googling said there is a JQuery plug-in that can help me, but I cannot figure out how to use it and get it working properly.

    Can anyone help me with this, please? :[
    This website is not live yet so I have to remove all related content from the coding below. Other than changed image URLs and titles, the coding is exactly what I have thus far:

    Code:
    <style type="text/css">
    body,td,th {
    	color: #e51827;
    }
    body {
    	background-color: #000;
    	style="height:100%"
    </style>
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Title_Here</title>
    </head>
    
    
    <body>
    <center>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td>
        
        <center>
        <img src="../images/bannerspace.jpg" width="93%"/>
        <p>
        <img src="../images/bannerspace.jpg" width="93%"/>
        <P>
        <img src="../images/bannerspace.jpg" width="93%"/>
        <P>
        <img src="../images/bannerspace.jpg" width="93%"/>
        </P>
    </center>
        </td>
        
        <td>
        <img src="../images/mainimage.jpg" width="93%" usemap="#Map" border="0"/>   
        </td>
      </tr>
    
      <tr>
        <td>&nbsp;</td>
        <td>
    <center>
              <!-- Counter Code START --><img src="http://www.e-zeeinternet.com/count.php?page=1049534&style=LED_r&nbdigits=5&reloads=1"  border="0" ><br><!-- Counter Code END -->
    </center>
        </td>
      </tr>
    </table>
    </center>
    
    <map name="Map" id="Map">
      <area shape="rect" coords="5,199,42,361" href="index.html" target="_self" alt="home" />
      <area shape="rect" coords="103,418,286,470" href="https://www.facebook.com" target="new" alt="facebook" />
      <area shape="rect" coords="368,458,563,495" href="contact.html" target="_self" alt="contact" />
      <area shape="rect" coords="712,190,744,377" href="enter.html" target="_self" alt="enter" />
      <area shape="rect" coords="114,127,297,178" href="availability.html" target="_self" alt="availability" />
      <area shape="rect" coords="436,207,577,252" href="currentprojects.html" target="_self" alt="currentprojects" />
    </map>
    </body>

  2. #2
    Join Date
    Mar 2012
    Posts
    3,968
    The answer is: An image map is not suitable for this purpose. Do not use an image map for your primary navigation in a responsive page. It does not work.

  3. #3
    Join Date
    Mar 2014
    Posts
    2
    Quote Originally Posted by jedaisoul View Post
    The answer is: An image map is not suitable for this purpose. Do not use an image map for your primary navigation in a responsive page. It does not work.
    Thanks for the answer but can you please provide me with a work-around?

  4. #4
    Join Date
    Mar 2012
    Posts
    3,968
    There is no work-around, but you can achieve a similar effect with a different functionality. E.g.:
    1. Copy the main image and crop it to include only one highlight area. Save it as, say, "home.jpg".
    2. Repeat 1. for the other highlights. Call them "about.jpg", "work.jpg" & "contact.jpg" (or whatever is appropriate...).

    You now have a set of graphics to build the nav.

    In the CSS:
    3. Use position absolute (this allows you to overlay divs etc...).
    4. Put the main graphic in the background of a parent DIV.
    5. Create child DIVs to position each "hot spot" w.r.t. the parent DIV.

    E.g. To create a full width graphical menu in the top 20% of the page which is divided laterally into four hot spots, use something like:
    Code:
    * {
    margin: 0;
    padding: 0;
    border: 0;
    }
    body {
    position: relative;
    width: 100%;
    height: 100%;
    }
    #parent {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 20%;
    }
    #home {
    position: absolute;
    top: 0;
    left: 0;
    width: 25%;
    height:100%;
    }
    #about {
    position: absolute;
    top: 0;
    left: 25%;
    width: 25%;
    height:100%;
    }
    #work {
    position: absolute;
    top: 0;
    left: 50%;
    width: 25%;
    height:100%;
    }
    #contact {
    position: absolute;
    top: 0;
    left: 75%;
    width: 25%;
    height:100%;
    }
    In the HTML use something like:
    Code:
    <div id="parent">
    <div id="home">
    <a href="index.html"><img src="home.jpg" alt="home"></a>
    </div>
    <div id="about">
    <a href="about.html"><img src="about.jpg" alt="about us"></a>
    </div>
    <div id="work">
    <a href="work.html"><img src="work.jpg" alt="work"></a>
    </div>
    <div id="contact">
    <a href="contact.html"><img src="contact.jpg" alt="contact"></a>
    </div>
    </div>
    I have not tested this code, so it may need some tweaking, but it gives the general idea.
    Last edited by jedaisoul; 04-01-2014 at 04:34 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.09157 seconds
  • Memory Usage 2,989KB
  • Queries Executed 13 (?)
More Information
Template Usage (31):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (3)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (4)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (27):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./includes/functions_threadedmode.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (71):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates