# Make a popup box resizable and draggable?

**URL:** <https://discourse.softpress.com/t/make-a-popup-box-resizable-and-draggable/26373>\
**Category:** Xway\
**Created:** [September 17, 2026, 2:24am UTC](https://discourse.softpress.com/t/make-a-popup-box-resizable-and-draggable/26373 "2026-09-17T02:24:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Noob](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/n/5e9695/32.png) [@Noob](https://discourse.softpress.com/u/Noob)\
**Post date:** [September 17, 2026, 2:24am UTC](https://discourse.softpress.com/t/make-a-popup-box-resizable-and-draggable/26373/1 "2026-09-17T02:24:41Z")

</div>

OK, I followed the comprehensive instructions in the Xway manual to create a popup box (p.95) and have it working. Excellent!

I now want to make the popup box resizable and draggable.

Let’s do resizable first. AI tells me to make it resizable I need to add `resize: both; overflow: auto;` to the `.overlay` class (I called the box ‘overlay’ as per the Xway instructions).

If I add those in Xway as “Extended HTML Attributes” to the overlay box, that appears in the HTML as `<div id="overlay" resize="both">` which obviously does nothing.

If I add these properties to “Extended Properties” in Xway, it appears in the `#overlay` ID in `<style>` in `<head>`. This also does **not** make the box resizable:

`#overlay { display:none; visibility:visible; position:fixed; left:0; top:0; right:0; bottom:0; min-height:100px; z-index:3; background:rgba(48,88,176,0.5); color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; font-size:small; resize:both }`

Looking at the HTML source, I cannot see a `.overlay` class anywhere… so any clues as to how I achieve a resizable box?

Thanks!

---

<div class="post-metadata">

**Author:** ![Jeremy](https://discourse.softpress.com/user_avatar/discourse.softpress.com/jeremy/32/2740_2.png) [@Jeremy](https://discourse.softpress.com/u/Jeremy)\
**Post date:** [September 17, 2026, 12:38pm UTC](https://discourse.softpress.com/t/make-a-popup-box-resizable-and-draggable/26373/2 "2026-09-17T12:38:52Z")

</div>

Hi BJ,

1. You want to target the “popup” box rather than the “overlay” box. The overlay box has **Fixed** position and is set to cover the content area of the window to provide a transparent dark background.
2. **resize** is a CSS property rather than an HTML attribute, so you need to add it in the **Extended Properties** section of the **Box Inspector**.
3. You don’t need to set a class unless you are applying a property to multiple elements. If you apply a property to a box, Xway uses the box ID to target that particular box. (Xway uses classes when outputting text styles.)
4. You don’t need to use an extended property to set overflow: you can choose **Auto** from the **Overflow** popup in the **Style** section of the **Box Inspector**.

So the only changes you need to make after following the steps in the Xway User Guide are:

1. Select the “popup” box.
2. Add **resize** (name) **both** (property) in the **Extended Properties** section of the **Box Inspector**.
3. Choose **Auto** from the **Overflow** popup in the **Style** section of the **Box Inspector**.

If you do this, you should see that the popup box has a resize widget in the bottom right corner.

---

<div class="post-metadata">

**Author:** ![Noob](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/n/5e9695/32.png) [@Noob](https://discourse.softpress.com/u/Noob)\
**Post date:** [September 17, 2026, 1:21pm UTC](https://discourse.softpress.com/t/make-a-popup-box-resizable-and-draggable/26373/3 "2026-09-17T13:21:44Z")

</div>

Fantastic thankyou - that works!

Dare I ask how the best way to make the popup draggable? AI says this JS needs to be added:

```javascript
const popup = document.getElementById("popup");
const header = document.getElementById("popupHeader");
const resizeHandle = document.getElementById("resizeHandle");

let x = 0, y = 0, w = 0, h = 0;

// --- Dragging Logic ---
header.addEventListener("mousedown", (e) => {
e.preventDefault();
// Get initial mouse position
x = e.clientX;
y = e.clientY;

document.addEventListener("mousemove", dragMove);
document.addEventListener("mouseup", dragStop);
});

function dragMove(e) {
// Calculate how far the mouse moved
const dx = e.clientX - x;
const dy = e.clientY - y;

// Update popup coordinates
popup.style.left = ${popup.offsetLeft + dx}px;
popup.style.top = ${popup.offsetTop + dy}px;

// Reset initial mouse markers
x = e.clientX;
y = e.clientY;
}

function dragStop() {
document.removeEventListener("mousemove", dragMove);
document.removeEventListener("mouseup", dragStop);
}

// --- Resizing Logic ---
resizeHandle.addEventListener("mousedown", (e) => {
e.preventDefault();
// Get initial size and mouse position
w = popup.clientWidth;
h = popup.clientHeight;
x = e.clientX;
y = e.clientY;

document.addEventListener("mousemove", resizeMove);
document.addEventListener("mouseup", resizeStop);
});

function resizeMove(e) {
// Calculate new width and height
const dw = e.clientX - x;
const dh = e.clientY - y;

popup.style.width = ${w + dw}px;
popup.style.height = ${h + dh}px;
}

function resizeStop() {
document.removeEventListener("mousemove", resizeMove);
document.removeEventListener("mouseup", resizeStop);
}

```

I’m not expecting you critique the JS, but:

1. is this the only way to make the box draggable, or do you have any other suggestions?
2. Should the JS be added to the **overlay** box, or to the **popup** box?

And since the CSS is now making the box resizable, I assume I can delete the resizing bits in the JS, and have it only do the dragging bits.

Thanks & cheers

---

<div class="post-metadata">

**Author:** ![Jeremy](https://discourse.softpress.com/user_avatar/discourse.softpress.com/jeremy/32/2740_2.png) [@Jeremy](https://discourse.softpress.com/u/Jeremy)\
**Post date:** [September 17, 2026, 2:07pm UTC](https://discourse.softpress.com/t/make-a-popup-box-resizable-and-draggable/26373/4 "2026-09-17T14:07:19Z")

</div>

I don’t think it’s possible (in a non-hacky way) to create a draggable box using CSS, so you probably do need to use JavaScript.

There are some good sites that have non-AI information about HTML and CSS. These are being plagiarised by AI, sadly, but they’re often more user-friendly. Here is one page that might be a good starting point: [How to Create a Draggable HTML Element](https://www.w3schools.com/howto/howto_js_draggable.asp).

Answering your second question: you want to target the “popup” box (as before), and you don’t need to use JavaScript for resizing. If you follow the W3Schools page mentioned above, one thing you will need to do is set the box to have absolute position instead of relative position (choose **Absolute** from the **Position** popup in the **Style** section of the **Box Inspector** ).

The W3Schools example also assumes that you have a “header” box within the popup box. This provides an area that users can drag (like a window bar on macOS).

The simplest way to add JavaScript on an Xway page is to put it in the **JavaScript Markup** section of the **Page Inspector**.

---

<div class="post-metadata">

**Author:** ![Jeremy](https://discourse.softpress.com/user_avatar/discourse.softpress.com/jeremy/32/2740_2.png) [@Jeremy](https://discourse.softpress.com/u/Jeremy)\
**Post date:** [September 17, 2026, 2:15pm UTC](https://discourse.softpress.com/t/make-a-popup-box-resizable-and-draggable/26373/5 "2026-09-17T14:15:06Z")

</div>

There is also a **draggable** HTML attribute, which is very simple: you can set this by adding **draggable** (name) **true** (value) in the **Extended HTML Attributes** section of the **Box Inspector**.

… but when I tried it in Safari, it created a temporary draggable copy of the popup, so I don’t think it’s what you’re looking for.

(I think it’s actually intended to be used for drag and drop operations.)
