Skip navigation
Currently Being Moderated

CSS code in a jQuery

Jul 19, 2012 10:23 AM

Hello

I am trying to incorporate a Google map in my website. Using samples from Google I have my map... but no markers. So... I have found a sample that uses javascript to load multiple markers called markers.js. I am now trying to change what I can in the *.js file to reflect "my" map.

 

First of probaly a numer of problems. I want my map to be 100%, the code in the *.js seems to regulate the size of the map by...

 

$(document).ready(function() {

  $("#map").css({

        height: 500,

        width: 600

    });

 

When I try to change to a % I get an error message on the line number (DW CS4, a red block)

My good map does it this way

 

<style type="text/css">

      html { height: 100% }

      body { height: 100%; margin: 0; padding: 0 }

      #map_canvas { height: 100% }     

    </style>

 

Can anyone advise me on what / how I can change this?

Thanks again for your time

Ralph

 

(and any tips on how to show snippets of code if this second attempt is still messed up)

 
Replies
  • Currently Being Moderated
    Jul 31, 2012 12:07 PM   in reply to Ralph3616

    You are dealing with JS so you need to escape the "text".

     

    $(document).ready(function() {

      $("#map").css({

            height: '100%',

            width: '100%'

        });

     

    But honestly, I would remove this and just use CSS as this is unnecessary.

     

    #map {height:100%;width:100%}

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points