| Correct URL of the gmap new pointer icon in my external JS?
|
carlozdre

msg:4386953 | 12:07 am on Nov 15, 2011 (gmt 0) | I load the js successfully with: <script src="<?php bloginfo('template_url'); ?>/js/google-map.js" type="text/javascript"></script>
I then have:
var apartments = new google.maps.MarkerImage('/images/apartment-3.png', new google.maps.Size(129, 42), new google.maps.Point(0,0), new google.maps.Point(18, 42) ); .. and load the apartments var for each POI I show on my Google map. The paths are /js/google-map.js and /images/apartment-3.png The js code for Google map display is correct because if I use the js code in the header with
var apartments = new google.maps.MarkerImage('<?php bloginfo('template_url'); ?>/images/apartment-3.png', for the image URL, it works. If I get the js in the external js file, my icon won't load anymore, even if I use /images/apartment-3.png or images/apartment-3.png for the URL of the new icon, which is normal as my header is on the root of this WP theme. What am I doing wrong? It's a WordPress platform.
|
rocknbil

msg:4387265 | 6:22 pm on Nov 15, 2011 (gmt 0) | What does template_url echo out as? Compare these two: ....MarkerImage('/images/apartment-3.png', // works ....MarkerImage('<?php bloginfo('template_url'); ?>/images/apartment-3.png', // doesn't So where does the image reside, at /images/apartment-3.png or in the wordpress theme directory? /wp-content/themes/your-theme/images/apartment-3.png The leading slash means "start at the domain root."
|
|
|