Gmaps4rails : Setting map width and height

后端 未结 3 382
说谎
说谎 2021-01-17 11:55

Reading the gmaps4rails gem documentation, I didn\'t find any way to set the map width and height. Is there any way to do this ?

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-17 12:33

    The answer by @apenadving didn't work for me, assuming that the map div classes and id's didn't change, I needed to do the following (in scss) in order to get things working correctly, maybe I'm missing something...

    .map_container{
       $width:675px;
       width:$width;
       .gmaps4rails_map{
         width: $width;
         height: 400px;
       }
    }
    

    Also with rails 3.1 and above you can simply do the following in your application.css.scss file

    @import "gmaps4rails";
    @import "myCoolStyle";
    

提交回复
热议问题