简体   繁体   English

如何在外部div保持不变的情况下缩放整个嵌套div

[英]How to zoom entire nested div while outer div remains same

I am trying to create organization charts using BasicPrimitives API. 我正在尝试使用BasicPrimitives API创建组织结构图。 This particular API takes a div id or class and fills its content with charts dynamically. 这个特定的API会使用div ID或类,并用图表动态填充其内容。 I want to add zoom in and out functionality which API does not provide, however, I failed to achieve it. 我想添加API不提供的放大和缩小功能,但是我无法实现。 What I want is mimicing viewport in computer games where everything inside should be scaled up or down and every part should be visible via scrolling. 我要模仿的是计算机游戏中的视口,其中的所有内容都应按比例放大或缩小,并且每个部分都应通过滚动显示。 I tried transform: scroll() on div but it does not scale entire content. 我在div上尝试了transform: scroll() ,但是它不能缩放整个内容。 Actually, I am not sure if it does or doesn't but I can't reach majority of my charts by scrolling. 实际上,我不确定是否可以,但是我无法通过滚动来查看大部分图表。 Then I tried zoomooz API but failed again. 然后,我尝试使用zoomooz API,但再次失败。 I checked this and this but I couldn't make it work. 我检查这个这个 ,但我不能使它工作。

My div is as follows: 我的股利如下:

<div id="diagram" style="height: 400px; width: 946px;">
</div>

Inside it, API that I am using creates another div which contains all charts etc. If I scale it with following code, scrolls can not reach some parts of diagram: 在其中,我正在使用的API创建另一个包含所有图表等的div。如果使用以下代码对其进行缩放,则滚动无法到达图表的某些部分:

jQuery(".orgdiagram > div").css({
    transform: "scale(1.25)"
});

Together with upper code, I tried changing the height and with before and after scale but it didn't work as well. 与上层代码一起,我尝试更改高度以及缩放前后的比例,但是效果不佳。 I am pretty new to web techs. 我对网络技术人员来说还很陌生。

this is a screen shot of situation, Upper part is pre-scaled version. 是情况的屏幕快照,上部是预缩放版本。 Lower part is post-scale. 下部是后规模。 My question is, what's problem? 我的问题是,什么问题? Why scroll is acting weird after scale and how can I fix this. 为什么滚动在缩放后表现奇怪,我该如何解决。

PS: Sorry for censor but they are private information. PS:很抱歉,但它们是私人信息。

I think you should use padding-right or left (unsure which one because they acting differently then they supposse to sometimes) since it seems like they are the issue to "view diagram" or whatever you added there will appear. 我认为您应该使用padding-rightleft (不确定哪一个是因为它们的行为不同于有时假定的行为),因为这似乎是“视图图”的问题,或者您会在其中添加任何内容。 Example: 例:

padding-right: 10px; /*same as left*/

EDIT 编辑

I also suggest you use table or menu (ul, li) to make those diagrams, it a lot more easier and you can add :last-child so you can edit the last one to 10px right/left. 我还建议您使用表格或菜单(ul,li)来制作这些图,它变得更加容易,并且可以添加:last-child以便您可以将最后一个编辑为左右10px。

There is no need to do that. 不需要这样做。 Chart supports zoom gesture on iPad. 图表支持iPad上的缩放手势。 You can zoom in/out using CSS based scale transform, but it is ugly on regular browsers, so it is turned off. 您可以使用基于CSS的比例转换来放大/缩小,但是在常规浏览器上却很难看,因此已将其关闭。 If you need equivalent zoom effect the best solution is to create 2-3 item templates having different size and auto switch between them. 如果需要等效的缩放效果,最好的解决方案是创建2-3个具有不同大小的项目模板,并在它们之间自动切换。 Or if you need smal chart, just make your item template small. 或者,如果您需要较小的图表,只需将项目模板缩小即可。 See example at web site . 请参阅网站上的示例

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM