Welcome Guest, Not a member yet? Register   Sign In
google maps position problem

I have a problem in positioning map of google maps
inside of the page this tutorial http://biostall.com/codeigniter-google-m...pi-library
in the library I found many things to change the map but not to move it.


You'll have to give us more information? Did you set your center?

You'll need to set it in the array you pass to the initialize. Kind of like this:

$config['center'] = "41.1323,-104.8126";
$config['zoom'] = '12';
$config['map_height'] = "350px";
$config['map_width'] = "660px";
$config['sensor'] = FALSE; // there was a bug with this in an earlier version...can't confirm if it's been fixed or not.  Possibly has been.

I was able to decrease the size of the map,
now remains on the left of the page I want to take it to the center of the page or on the right

Moving the map on your page is going to be a result of your CSS or however you've got your page created. I've got a couple of different sites using this library and the map is where I want it on the page.

THank you every people

this is my controller

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Mappa extends CI_Controller {

public function index()

$config['center'] = '44.339963, 11.292732';
$config['zoom'] = 12;
$config['map_height'] = "350px";
$config['map_width'] = "660px";
$config['sensor'] = FALSE;

$circle = array();
$circle['center'] = '44.339963, 11.292732';
$circle['radius'] = '100';

$data['map'] = $this->googlemaps->create_map();

I want to do and put in the middle of the page map

this is my view

<!DOCTYPE html>
        &lt;?php echo $map['js']; ?&gt;

        &lt;?php echo $map['html']; ?&gt;


how can I change the css on this code?

Basic css positioning using a wrapper div champ !!!
<div s.tyle="margin-left:100px">
    &lt;?php echo $map['html']; ?&gt;
(replace s.tyle with style)

Or whatever works... depending on the rest of your code you may want/have to use one of (or a combination of):
- float:right;
- padding-left:100px;
- position:relative; left:100px;
- position:absolute; left:100px;

Keep in mind that if your div holding your map is initially hidden, like it's in a tab or something, that you will have to trigger a "resize" event on the map when that tab is activated so it can redraw it or it won't be centered (or part of the map is missing). If the div is initially hidden, maps can't calculate the area needed to display. It can only do it once the div is shown.
google.maps.event.trigger(map, 'resize');

thank you!!!! I solved the problem I was able to put the map where I wanted


Theme © iAndrew 2016 - Forum software by © MyBB