简体   繁体   中英

Chrome extension popup resizability by user

I'm currently designing a Chrome Extension
and I want to make the size of the popup itself changeable by user.

popup.html is the content that goes inside the popup.
So in order to do something with the popup itself, I think I'll have to work with the codes in popup.js , but before starting, I want to know if this is possible.

Thank you in advance.

Besides @wOxxOm's answer, you could also add a div inside popup body and set its resize CSS property both .

style:

div {
  resize: both;
  overflow: auto;
}

HTML:

<body>
  <div>
    I am div
  </div>
</body>

在此处输入图片说明

Borders of the extension toolbar popup aren't resizable, but you can implement the functionality yourself by adding 3 thin div elements (4px x 100%, for example) on sides of the popup except for the top, add mousedown event listener on each one that will set a global boolean flag, which will be used in mousemove handler, and unset in mouseup . To actually resize the popup simply set document.body.style.width = newWidth + 'px' , for example. To provide visual cues add :hover CSS on those div elements with corresponding cursor: .... rule.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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