search

Home  >  Q&A  >  body text

javascript - When scaling an element, only the enlarged lower right content can be seen by scrolling.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
</head>
<body>
<p style="width: 970px;height: 651px;overflow: auto">
    <img style="display: block;transform: scale(1.5)" src="https://cloud.githubusercontent.com/assets/6072743/26030200/1ca3370a-387e-11e7-9c6d-8d1b029c90cc.png">
</p>
</body>
</html>

The zoomed content in the upper left corner cannot be seen. In addition to setting transfrom-origin to left top, is there any other way?

天蓬老师天蓬老师2752 days ago940

reply all(2)I'll reply

  • 世界只因有你

    世界只因有你2017-05-17 09:58:07

    transform-origin: 0 0;

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-17 09:58:07

    To be able to scroll, transform cannot be used

    <!DOCTYPE html>
    <html>
    <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width">
      <title>JS Bin</title>
    </head>
    <body>
    <p style="width: 970px;height: 651px;overflow: auto">
        <img style="display: block;min-width: 150%;min-height: 150%;" onload="var parent=this.parentElement;parent.scrollTop=(parent.scrollHeight-parent.clientHeight)/2;parent.scrollLeft=(parent.scrollWidth-parent.clientWidth)/2;" src="https://cloud.githubusercontent.com/assets/6072743/26030200/1ca3370a-387e-11e7-9c6d-8d1b029c90cc.png">
    </p>
    </body>
    </html>

    reply
    0
  • Cancelreply