Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/415.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript RubyonRails-Gmap4Rails弹出窗口用于更大的地图_Javascript_Ruby On Rails_Ruby On Rails 3_Google Maps_Gmaps4rails - Fatal编程技术网

Javascript RubyonRails-Gmap4Rails弹出窗口用于更大的地图

Javascript RubyonRails-Gmap4Rails弹出窗口用于更大的地图,javascript,ruby-on-rails,ruby-on-rails-3,google-maps,gmaps4rails,Javascript,Ruby On Rails,Ruby On Rails 3,Google Maps,Gmaps4rails,我是rails初学者,正在使用rails 3.2.3 在我的应用程序中,我使用了非常棒的Google Maps for Rails(非常棒) 一切都很好,但我遇到了一个问题,没有找到任何答案在这里和那里为我想做的事 基本上,我正在显示一个小地图,并希望有一个按钮在它下面,当用户点击它,一个更大的地图将显示该位置。 (基本上是同一张地图,只是尺寸更大) 大概是这样的: <input type="button" onclick="myFunction()" value="Show a bigg

我是rails初学者,正在使用rails 3.2.3

在我的应用程序中,我使用了非常棒的Google Maps for Rails(非常棒)

一切都很好,但我遇到了一个问题,没有找到任何答案在这里和那里为我想做的事

基本上,我正在显示一个小地图,并希望有一个按钮在它下面,当用户点击它,一个更大的地图将显示该位置。 (基本上是同一张地图,只是尺寸更大)

大概是这样的:

<input type="button" onclick="myFunction()" value="Show a bigger map" />

但是我的问题是在javascript函数中放什么,以及我如何说应该显示一个更大的带有@gmaps值的映射

在gmaps css中创建一个更大且高度更高的新id? 如何向JS提供来自my@gmaps的数据

有什么建议吗

抱歉,如果这是一个幼稚的问题,我仍然习惯于RoR和Gmaps4Rails gem。 提前感谢您抽出时间


关于

我不太确定您想做什么,但我想说,将一个映射的参数复制到另一个映射是非常容易的

事实上,创建地图所需的全部代码都可以在html中看到,只需重现这些步骤即可

gmaps_助手将为您的小地图执行此任务。基本上,它遵循以下步骤:

Gmaps.map = new Gmaps4RailsGoogle();
//mandatory
Gmaps.map.initialize();
// then some code depending on your options
Gmaps.map.markers = some_array;
Gmaps.map.create_markers();
无论何时,只要按照相同的步骤复制地图,即可:

Gmaps.bigmap = new Gmaps4RailsGoogle();
//mandatory to have the map created in the proper place
Gmaps.bigmap.map_options.id = the_id_of_your_html_div;
//still mandatory
Gmaps.bigmap.initialize();

//copy the specific parameters from the other map
Gmaps.bigmap.markers = Gmaps.map.markers;
Gmaps.bigmap.create_markers();