使用浏览器窗口调整内容大小
我有一张制作为 flash/swf 电影的英国地图。该地图嵌入在 div 标签中,并以 2 列布局向右浮动,其中包含左列、页眉和页脚。 我希望当用户调整浏览器大小时地图能够自行调整大小,或者我希望随着左列高度的增加和减少而调整地图大小。基本上,地图应该遵循浏览器的宽度/高度或左列高度。我该怎么做?
非常感谢
I have a UK map made as a flash/swf movie. This map is embeded in a div tag and floated aright in a 2 column layout with a left column, a header and a footer.
I want the map to resize itself when the browser is being resized by the user or I want it to be resized as the left column's height increases and decreases. Basically the map should follow the browser's width/height or the left column height. How do I do that?
Many Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
给每只猫剥皮的方法有很多种,但至少您需要确保您的 SWF 内容适合容器大小。如果它的大小是固定的,那么所有的赌注都会被取消。真正的挑战是让左列中的内容符合右列中的更改,尤其是在仅使用 CSS 和 DIV 时。如果没有一些不自然和复杂的体操,我不确定这是否可能。
一种更简单、更直接且可能的老式方法是仅使用具有单行和两个单元格的表作为列结构。使用 100% 宽度和高度强制表格适合页面。这样就可以保证左列的高度始终是右列的高度。此时,您只需确保右列中的 SWF 容器使用 % 来表示其高度。
另一种方法是使用 JavaScript 拦截浏览器调整大小事件,并在发生这种情况时调整 SWF 容器的大小。
There are many many different ways to skin every cat, but at the very least you need to make sure your SWF content scales to the container size. If it's a fixed size, all bets are off. The real challenge is getting something in the left column to conform to changes in the right column, especially when using just CSS and DIVs. I'm not sure that's possible without some unnatural and complex gymnastics.
A simpler, more direct, and possible old-school method is to just use a TABLE with a single row and two cells as your column structure. Force the table to fit the page using 100% width and height. Then you're guaranteed that the left column will always be the height of the right column. At that point you just need to make sure the SWF container in the right column uses a % for its height.
Another approach is to use javascript to intercept browser resize events and to resize the SWF container when that happens.