在Rails中使用框架(或iframe)的最佳做法是什么?

时间:2023-02-10 20:04:07

I'm building a Ruby on Rails app where people are clicking on addresses. When they click, I want to display a small google map of the address in a frame. I want to use a frame/iframe so when they scroll down to look at more addresses, the little map won't scroll off too.

我正在构建一个Ruby on Rails应用程序,人们点击地址。当他们点击时,我想在一个框架中显示地址的小谷歌地图。我想使用框架/ iframe,所以当它们向下滚动以查看更多地址时,小地图也不会滚动。

I'm having a hard time finding examples or discussions of this. I was thinking of hacking up the layout with raw <FRAMESET> tags, but that seems kind of barbaric. What is the best way to use frames or iframes within a Rails app?

我很难找到这方面的例子或讨论。我正在考虑用原始的标签来破坏布局,但这看起来很野蛮。在Rails应用程序中使用框架或iframe的最佳方法是什么?

BTW, we're using Haml for our templating, if it matters.

顺便说一下,如果重要的话,我们会将Haml用于模板。

2 个解决方案

#1


you could try the Greybox jQuery plugin.

你可以试试Greybox jQuery插件。

#2


You can anchor an iframe to the side of your page (or bottom or whatever) using CSS (position: fixed). If you do that, be sure to take into consideration overlapping issues. This is easily resolved with a margin for body.

您可以使用CSS(位置:固定)将iframe锚定到页面的一侧(或底部或其他)。如果您这样做,请务必考虑重叠问题。这很容易解决身体的余地。

#1


you could try the Greybox jQuery plugin.

你可以试试Greybox jQuery插件。

#2


You can anchor an iframe to the side of your page (or bottom or whatever) using CSS (position: fixed). If you do that, be sure to take into consideration overlapping issues. This is easily resolved with a margin for body.

您可以使用CSS(位置:固定)将iframe锚定到页面的一侧(或底部或其他)。如果您这样做,请务必考虑重叠问题。这很容易解决身体的余地。