简体   繁体   English

在中心缩放后如何获取图像/div左侧的滚动条

[英]How to get Scrollbar for left side of the Image/Div after it is scaled at the center

I'm centering an image using display:flex & justify-content:center and using some zoom buttons to scale the image when they're clicked.我使用display:flexjustify-content:center使图像居中,并在单击时使用一些缩放按钮来缩放图像。

The issue is that I'm not able to get a scroll bar to go to the Left Side of the image after it is scaled.问题是我无法在缩放后将滚动条显示到图像左侧的 go。

I checked about the scaling property and learned that it scales the (0,0) coordinates and possibly I'm trying to go the negative coordinates ( https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/scale()#scaling_the_x_and_y_dimensions_together )我检查了缩放属性并了解到它缩放(0,0)坐标,可能我正在尝试 go 负坐标( https://developer.mozilla.org/en-US/docs/Web/CSS/变换函数/缩放()#scaling_the_x_and_y_dimensions_together

Is there anything i can do to go to have full access of the image after it is being scaled?在缩放图像后,我可以对 go 做些什么来完全访问图像? (by full access i mean to the left/right/top/bottom) Here is the fiddle for reference: https://jsfiddle.net/r9sdhjyz/1/ (通过完全访问我的意思是左/右/上/下)这是小提琴供参考: https://jsfiddle.net/r9sdhjyz/1/

As far as I understand, you want scroller to the left side.据我了解,您希望将滚动条移到左侧。

Just add direction: rtl;只需添加direction: rtl; in the styling of parent element like this在这样的父元素的样式中

#parent{
  height:400px;
  width:400px;
  overflow:scroll;
  display:flex;
 justify-content:center;
 direction:rtl;
}

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

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