Skip to content

Commit 4873ee5

Browse files
adding resizeable not draggable
1 parent 84cd57a commit 4873ee5

File tree

3 files changed

+15
-44
lines changed

3 files changed

+15
-44
lines changed

app.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -359,26 +359,6 @@ document.getElementById('minimise-btn').addEventListener('click', () => {
359359
renderLeaderboard();
360360
});
361361

362-
const dragEl = document.getElementById("draggable-wrapper");
363-
let isDragging = false, offsetX = 0, offsetY = 0;
364-
365-
dragEl.addEventListener("mousedown", (e) => {
366-
isDragging = true;
367-
offsetX = e.clientX - dragEl.offsetLeft;
368-
offsetY = e.clientY - dragEl.offsetTop;
369-
dragEl.style.cursor = "grabbing";
370-
});
371-
372-
document.addEventListener("mousemove", (e) => {
373-
if (!isDragging) return;
374-
dragEl.style.left = `${e.clientX - offsetX}px`;
375-
dragEl.style.top = `${e.clientY - offsetY}px`;
376-
});
377-
378-
document.addEventListener("mouseup", () => {
379-
isDragging = false;
380-
dragEl.style.cursor = "grab";
381-
});
382362

383363
/*
384364
// Reload matches every 30 seconds

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ <h1>Welcome to the Year 8 Chess Tournament</h1>
2525
<div id="game-panel" style="display:none; text-align: center;">
2626
<h2>Your Current Game</h2>
2727
<button><a style="text-decoration: none; color: #fff;" id="game-link" href="#" target="_blank">Join Game</a></button><br><br>
28-
<div id="draggable-wrapper" class="iframe-wrapper">
28+
<div class="iframe-wrapper">
2929
<div class="iframe-loader"></div>
3030
<iframe id="userGame" src="" onload="hideIframeLoader(this)"></iframe>
3131
</div>

style.css

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,19 @@ iframe {
9292
}
9393

9494
.iframe-wrapper {
95-
width: 100%;
96-
max-width: 370px;
97-
aspect-ratio: 1 / 1;
98-
margin: 0 auto;
99-
position: relative;
95+
resize: both;
96+
overflow: auto;
97+
width: 360px;
98+
height: 370px; /* 360 board + ~10px for moves list if needed */
99+
max-width: 100%;
100+
max-height: 90vh;
101+
min-width: 300px;
102+
min-height: 300px;
103+
margin: 1rem auto;
104+
border: 1px solid #444;
105+
border-radius: 8px;
106+
background-color: #2e2e2e; /* Matches Lichess dark theme */
107+
display: block;
100108
}
101109

102110
#userGame {
@@ -105,25 +113,8 @@ iframe {
105113
border: none;
106114
border-radius: 8px;
107115
display: block;
108-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
109-
position: absolute;
110-
top: 0;
111-
left: 0;
112116
}
113-
114-
#draggable-wrapper {
115-
background-color: #2e2e2e;
116-
max-width: 360px;
117-
padding: 1rem;
118-
border-radius: 8px;
119-
box-shadow: 0 0 8px rgba(0,0,0,0.3);
120-
position: absolute; /* needed for dragging */
121-
top: 100px;
122-
left: 100px;
123-
cursor: grab;
124-
z-index: 1000;
125-
}
126-
117+
127118
.iframe-loader {
128119
position: absolute;
129120
top: 50%;

0 commit comments

Comments
 (0)