Skip to content

Commit a582cab

Browse files
committed
feat: fullscreen transition
1 parent b7f07f1 commit a582cab

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

assets/js/script.js

+14
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ function dragElement(elmnt) {
6969
pos3 = 0,
7070
pos4 = 0;
7171
let windowHeader = elmnt.querySelector(".header");
72+
let transition = elmnt.style.transition;
7273

7374
if (windowHeader) {
7475
windowHeader.onmousedown = dragMouseDown;
@@ -88,6 +89,7 @@ function dragElement(elmnt) {
8889
startPos = e.clientX || window.event.clientX;
8990

9091
elmnt.style.willChange = "top, left";
92+
elmnt.style.transition = "none";
9193

9294
document.onmousemove = mouseElementDrag;
9395
document.onmouseup = mouseCloseDragElement;
@@ -100,6 +102,7 @@ function dragElement(elmnt) {
100102
startPos = e.clientX || window.event.clientX;
101103

102104
elmnt.style.willChange = "top, left";
105+
elmnt.style.transition = "none";
103106

104107
document.ontouchmove = touchElementDrag;
105108
document.ontouchend = touchCloseDragElement;
@@ -133,6 +136,7 @@ function dragElement(elmnt) {
133136
endPos = e.clientX || window.event.clientX;
134137

135138
elmnt.style.willChange = "auto";
139+
elmnt.style.transition = transition;
136140

137141
document.onmouseup = null;
138142
document.onmousemove = null;
@@ -142,6 +146,7 @@ function dragElement(elmnt) {
142146
endPos = e.clientX || window.event.clientX;
143147

144148
elmnt.style.willChange = "auto";
149+
elmnt.style.transition = transition;
145150

146151
document.ontouchend = null;
147152
document.ontouchmove = null;
@@ -155,6 +160,7 @@ function resizeElement(elmnt) {
155160
pos4 = 0;
156161

157162
let resizer = elmnt.querySelector(".resizer");
163+
let transition = elmnt.style.transition;
158164

159165
if (resizer) {
160166
resizer.onmousedown = dragMouseDown;
@@ -170,6 +176,8 @@ function resizeElement(elmnt) {
170176
pos3 = e.clientX;
171177
pos4 = e.clientY;
172178

179+
elmnt.style.transition = "none";
180+
173181
startPos = e.clientX || window.event.clientX;
174182

175183
document.onmousemove = mouseElementDrag;
@@ -180,6 +188,8 @@ function resizeElement(elmnt) {
180188
pos3 = e.touches[0].clientX;
181189
pos4 = e.touches[0].clientY;
182190

191+
elmnt.style.transition = "none";
192+
183193
startPos = e.clientX || window.event.clientX;
184194

185195
document.ontouchmove = touchElementDrag;
@@ -232,13 +242,17 @@ function resizeElement(elmnt) {
232242

233243
document.onmouseup = null;
234244
document.onmousemove = null;
245+
246+
elmnt.style.transition = transition;
235247
}
236248

237249
function touchCloseDragElement(e) {
238250
endPos = e.clientX || window.event.clientX;
239251

240252
document.ontouchend = null;
241253
document.ontouchmove = null;
254+
255+
elmnt.style.transition = transition;
242256
}
243257
}
244258

assets/scss/style.scss

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ $screen-bg: #008081;
5656
flex-direction: column;
5757
width: 500px;
5858
height: 190px;
59+
transition: all 0.1s ease-in-out;
5960

6061
&.active {
6162
display: flex;
@@ -66,6 +67,7 @@ $screen-bg: #008081;
6667
left: 0 !important;
6768
width: 100% !important;
6869
height: calc(100vh - 40px) !important;
70+
transition: all 0.2s ease-in-out;
6971
}
7072

7173
.header {

0 commit comments

Comments
 (0)