放大元素而不改变元素的大小
例如;如果我有一个画布画布图,并且我希望能够查看其中一个区域的特写,我希望能够放大特定区域并显示一个滚动条以进行水平和垂直平移,以便可以查看每个部分。这可能吗?
For example; if I had a flot canvas graph and I wanted to be able to view a closeup of one of the areas, I want to be able to zoom into a specific area and have a scrollbar appear for horizontal and vertical panning so every section can be viewed. Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能需要使用
zoom
CSS 属性。这是它的一个小例子。至于滚动条,您可以尝试将缩放元素放置在设置了
overflow:scroll;
的父元素中。我希望这有帮助。
You may want to use the
zoom
CSS property. Here is a little example of it in action.As for the scroll bars, you could try placing the zoomed element within a parent which has
overflow: scroll;
set.I hope this helps.
一切皆有可能,但 flot 本身并不支持这一点。最好的选择是使用 flot 内置的平移和缩放功能(通过导航插件),但是对于滚动条,您可能必须覆盖一些假滚动条(可能使用带有
overflow:scroll,如@Wolfy87建议的那样)并将它们连接到flot图上。
当图形移动时,Flot 会触发
plotpan
和plotzoom
事件,因此您可以使用它们来保持滚动条同步。我以前没见过有人这样做,所以我无法给你举一个例子。但代码放在一起似乎也不是不合理。
Anything is possible, but flot doesn't support that by itself. Your best bet would be to use the panning and zooming functions built into flot (via the navigate plugin), but then for the scrollbars, you might have to overlay some fake scrollbars (perhaps using a div with
overflow:scroll
, as @Wolfy87 suggested) and hook them up to the flot graph.Flot triggers
plotpan
andplotzoom
events when the graph has moved, so you would use them to keep your scrollbars in sync.I haven't seen anyone do this before, so I can't point you towards an example. But the code doesn't seem unreasonable to put together.