Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1065
Set width and height of the map to device
posted

Hi,

I am using JQUERY Map control and Now I want to fix the map to width and height of the device.

I need to make the loaded shape exactly fit to the device.

Can anyone post me the answer.

Regards,

Dharmendar.

  • 1775
    Suggested Answer
    posted

    Hi, Dharmendar

    In general you can set the width and height of any HTML element to 100% and it will take all available space. The problem is that you also need to specify 100% height for its containers if you want to take the full height of the page. That means you have to set this by CSS for the html and body elements like this:

    1. <style>
    2.     html {
    3.         height: 100%;
    4.     }
    5.     body {
    6.         margin: 0;
    7.         padding: 0;
    8.         height: 100%;
    9.     }
    10.     
    11.     #map
    12.     {
    13.         width: 100%;
    14.         height: 100%;
    15.     }
    16. </style>

    Set the width and height options of the map control to 100% like this:

    1. $("#map").igMap({
    2.     width: "100%",
    3.     height: "100%",
    4.     . . .
    5. });

    Cheers, Lazar