通过放置控件进行放大/缩小
我正在使用 JavaScript 的 Zoomin 属性来缩放页面背景图像及其所有控件(即文本框)。但在缩放时,控件的位置受到干扰。任何机构都可以帮助我解决这个问题
i am using zoomin property of JavaScript to zoom page background image and all its controls(i.e text boxes). but while zooming the position of the controls got disturbed. any body can help me to fix this issue
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,没有“JavaScript 的 Zoomin 属性”,所以这是你的第一个问题;-) 然而,有一个名为“zoom”的 Internet Explorer-only(即 Microsoft 垃圾)CSS 属性,你可以在这里阅读更多信息: http://reference.sitepoint.com/css/zoom
正如您将阅读的该网站“应用了缩放的元素周围的内容将重排,以考虑当缩放设置为非正常值时将发生的调整大小。”。换句话说,“控件的位置受到干扰”这一事实实际上是预料之中的;没有办法在不破坏布局的其余部分的情况下“缩放”(至少通过 CSS 属性)。
可能的一件事是,如果您要对您计划“放大”的所有内容设置“position:absolute”。这样做将需要您重新设计您的布局,但理论上它应该允许您更改这些元素(通过正常方式,如高度和宽度属性,或通过奇怪的东西,如缩放),并且不让它们影响其他任何内容的布局(因为绝对定位的元素不应该影响页面上其他任何内容的布局)。
希望有帮助。
First off, there is no "zoomin property of JavaScript", so there's your first problem ;-) There is however an Internet-Explorer-only (ie. Microsoft garbage) CSS property called "zoom", which you can read more about here: http://reference.sitepoint.com/css/zoom
As you'll read at that site "The content surrounding an element that has zoom applied will reflow to account for the resizing that will occur when zoom is set to a value other than normal.". In other words, the fact that "the position of the controls got disturbed" is actually expected; there is no way to "zoom" (via that CSS property at least) without disrupting the rest of your layout.
The one thing that might work is if you were to set "position:absolute" on all of the stuff you plan to "zoom in" on. Doing this will require you to rework your layout, but in theory it should allow you to change those elements (either via normal means like their height and width properties, or via strange stuff like zoom) and not have them affect the layout of anything else (as absolutely positioned elements are not supposed to affect the layout of anything else on the page).
Hope that helps.