Skip to content

Commit d947d67

Browse files
committed
fix: 🐛 fix img follow as you change screen
1 parent 410fd6f commit d947d67

File tree

3 files changed

+142
-103
lines changed

3 files changed

+142
-103
lines changed

css/main.css

Lines changed: 122 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ body {
5353
overflow: hidden;
5454
}
5555

56-
.content.loading *{
57-
opacity:0;
56+
.content.loading * {
57+
opacity: 0;
5858
}
5959

6060
.panel {
@@ -63,7 +63,7 @@ body {
6363
height: 100%;
6464
top: 0;
6565
left: 0;
66-
transition:.3s;
66+
transition: .3s;
6767
}
6868

6969
/* setting */
@@ -153,13 +153,13 @@ body {
153153
background: rgba(100, 200, 255, .3);
154154
}
155155

156-
#setting #saveBtn{
156+
#setting #saveBtn {
157157
width: max-content;
158-
font-size:1.2rem;
159-
margin:30px auto 10px;
160-
padding:10px 30px;
161-
background:#e50;
162-
border-radius:20px;
158+
font-size: 1.2rem;
159+
margin: 30px auto 10px;
160+
padding: 10px 30px;
161+
background: #e50;
162+
border-radius: 20px;
163163
text-shadow: #900 0 0 5px;
164164
}
165165

@@ -288,6 +288,7 @@ body {
288288
border: 10px solid #fff;
289289
opacity: .1;
290290
border-radius: 50%;
291+
display: inline-block;
291292
}
292293

293294
#main01 footer {
@@ -306,12 +307,14 @@ body {
306307
z-index: 2;
307308
vertical-align: middle;
308309
}
309-
#main01 footer .monster-btn svg{
310-
transition:.3s;
311-
background:none;
310+
311+
#main01 footer .monster-btn svg {
312+
transition: .3s;
313+
background: none;
312314
}
313-
#main01 footer .monster-btn.click svg{
314-
width:90%;
315+
316+
#main01 footer .monster-btn.click svg {
317+
width: 90%;
315318
}
316319

317320
/* main02 */
@@ -348,7 +351,7 @@ body {
348351
color: #ddd;
349352
margin: 0 auto;
350353
padding: 10px 1rem;
351-
box-shadow:inset #ccc 0 0 0 0, #ccc 0 0 0 3px;
354+
box-shadow: inset #ccc 0 0 0 0, #ccc 0 0 0 3px;
352355
border-radius: 10px;
353356
border-top-right-radius: 0;
354357
border-bottom-right-radius: 0;
@@ -358,12 +361,12 @@ body {
358361
display: inline-block;
359362
font-size: 1.5rem;
360363
line-height: 1;
361-
box-shadow:inset #ccc 0 0 0 0, #ccc 0 0 0 3px;
364+
box-shadow: inset #ccc 0 0 0 0, #ccc 0 0 0 3px;
362365
border-radius: 10px;
363366
background: rgba(255, 255, 255, .1);
364367
color: #fff;
365368
vertical-align: top;
366-
transition:.3s;
369+
transition: .3s;
367370
padding: 10px 1rem;
368371
border-top-left-radius: 0;
369372
border-bottom-left-radius: 0;
@@ -372,26 +375,26 @@ body {
372375

373376
#main02 .input-group-button.click {
374377
background: rgba(255, 255, 255, .4);
375-
box-shadow:inset #ccc 0 0 0 3px, #ccc 0 0 0 0;
378+
box-shadow: inset #ccc 0 0 0 3px, #ccc 0 0 0 0;
376379
}
377380

378381
#main02 .btn {
379382
display: inline-block;
380383
width: 38%;
381384
height: 14%;
382-
box-shadow:inset #ccc 0 0 0 0, #ccc 0 0 0 3px;
385+
box-shadow: inset #ccc 0 0 0 0, #ccc 0 0 0 3px;
383386
margin: 7px 5px;
384387
border-radius: 10px;
385388
background: rgba(255, 255, 255, .1);
386389
color: #fff;
387390
vertical-align: top;
388391
-webkit-user-select: none;
389-
transition:.3s;
392+
transition: .3s;
390393
}
391394

392395
#main02 .btn.click {
393396
background: rgba(255, 255, 255, .4);
394-
box-shadow:inset #ccc 0 0 0 3px, #ccc 0 0 0 0;
397+
box-shadow: inset #ccc 0 0 0 3px, #ccc 0 0 0 0;
395398
}
396399

397400
#main02 .btn::before {
@@ -406,122 +409,139 @@ body {
406409
display: inline-block;
407410
vertical-align: middle;
408411
font-size: 1.5rem;
409-
transition:.3s;
412+
transition: .3s;
410413
}
411414

412415
#main02 .btn.click span {
413416
font-size: 1.4rem;
414417
}
415418

416419
/* popup */
417-
#popup{
418-
top:20%;
419-
left:15%;
420-
width:70%;
421-
height:max-content;
422-
border:3px solid #fff;
423-
z-index:20;
424-
border-radius:20px;
425-
padding:30px 10px;
426-
text-align:center;
427-
background:rgba(50,100,150,.9);
428-
color:#fff;
429-
opacity:0;
420+
#popup {
421+
top: 20%;
422+
left: 15%;
423+
width: 70%;
424+
height: max-content;
425+
border: 3px solid #fff;
426+
z-index: 20;
427+
border-radius: 20px;
428+
padding: 30px 10px;
429+
text-align: center;
430+
background: rgba(50, 100, 150, .9);
431+
color: #fff;
432+
opacity: 0;
430433
pointer-events: none;
431-
transition:.3s;
434+
transition: .3s;
432435
}
433-
#popup.show{
434-
top:17%;
435-
opacity:1;
436+
437+
#popup.show {
438+
top: 17%;
439+
opacity: 1;
436440
pointer-events: auto;
437441
}
438-
#popup h4{
439-
font-size:1.1rem;
440-
margin-bottom:10px;
442+
443+
#popup h4 {
444+
font-size: 1.1rem;
445+
margin-bottom: 10px;
441446
}
442-
#saveUrl{
443-
font-size:1.1rem;
444-
width:100%;
445-
word-wrap:break-word;
447+
448+
#saveUrl {
449+
font-size: 1.1rem;
450+
width: 100%;
451+
word-wrap: break-word;
446452
line-height: 1.5;
447453
}
448-
#saveUrl::selection{
449-
color:#fff;
450-
background:none;
454+
455+
#saveUrl::selection {
456+
color: #fff;
457+
background: none;
451458
}
452-
#copy{
453-
font-size:1.1rem;
454-
padding:10px 30px;
455-
width:max-content;
456-
margin:20px auto 0;
457-
background:#e50;
458-
border-radius:20px;
459+
460+
#copy {
461+
font-size: 1.1rem;
462+
padding: 10px 30px;
463+
width: max-content;
464+
margin: 20px auto 0;
465+
background: #e50;
466+
border-radius: 20px;
459467
}
460-
#copy.copied{
468+
469+
#copy.copied {
461470
pointer-events: none;
462-
opacity:.7;
471+
opacity: .7;
463472
}
464-
#popupClose{
465-
position:absolute;
466-
width:40px;
467-
height:40px;
473+
474+
#popupClose {
475+
position: absolute;
476+
width: 40px;
477+
height: 40px;
468478
border-radius: 50%;
469-
border:3px solid #fff;
470-
background:#123;
471-
top:-18px;
472-
right:-18px;
479+
border: 3px solid #fff;
480+
background: #123;
481+
top: -18px;
482+
right: -18px;
473483
}
484+
474485
#popupClose::before,
475-
#popupClose::after{
476-
content:"";
477-
position:absolute;
478-
width:80%;
479-
height:10%;
486+
#popupClose::after {
487+
content: "";
488+
position: absolute;
489+
width: 80%;
490+
height: 10%;
480491
transform-origin: 50% 50%;
481-
background:#fff;
482-
top:45%;
483-
left:10%;
492+
background: #fff;
493+
top: 45%;
494+
left: 10%;
484495
}
485-
#popupClose::before{
486-
transform:rotate(45deg);
496+
497+
#popupClose::before {
498+
transform: rotate(45deg);
487499
}
488-
#popupClose::after{
489-
transform:rotate(-45deg);
500+
501+
#popupClose::after {
502+
transform: rotate(-45deg);
490503
}
491504

492505
/* message */
493506

494-
#message{
495-
width:60%;
496-
top:-10px;
497-
left:20%;
498-
height:max-content;
499-
background:rgba(255,255,255,.2);
500-
border:1px dashed #fff;
501-
border-radius:20px;
507+
#message {
508+
width: 60%;
509+
top: -10px;
510+
left: 20%;
511+
height: max-content;
512+
background: rgba(255, 255, 255, .2);
513+
border: 1px dashed #fff;
514+
border-radius: 20px;
502515
padding: 0 10px;
503-
opacity:0;
504-
transition:.3s;
516+
opacity: 0;
517+
transition: .3s;
505518
pointer-events: none;
506519
}
507-
#message.show{
508-
opacity:1;
509-
top:15px;
520+
521+
#message.show {
522+
opacity: 1;
523+
top: 15px;
510524
}
511525

512-
#message h4{
513-
color:#fff;
514-
font-size:1.2rem;
515-
text-align:center;
516-
line-height:1.8;
526+
#message h4 {
527+
color: #fff;
528+
font-size: 1.2rem;
529+
text-align: center;
530+
line-height: 1.8;
517531
}
518532

519533
.noselect {
520-
-webkit-touch-callout: none; /* iOS Safari */
521-
-webkit-user-select: none; /* Safari */
522-
-khtml-user-select: none; /* Konqueror HTML */
523-
-moz-user-select: none; /* Old versions of Firefox */
524-
-ms-user-select: none; /* Internet Explorer/Edge */
525-
user-select: none; /* Non-prefixed version, currently
534+
-webkit-touch-callout: none;
535+
/* iOS Safari */
536+
-webkit-user-select: none;
537+
/* Safari */
538+
-khtml-user-select: none;
539+
/* Konqueror HTML */
540+
-moz-user-select: none;
541+
/* Old versions of Firefox */
542+
-ms-user-select: none;
543+
/* Internet Explorer/Edge */
544+
user-select: none;
545+
/* Non-prefixed version, currently
526546
supported by Chrome, Edge, Opera and Firefox */
527547
}

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html lang="zh-Hant-Tw">
2+
<html lang="zh-Hant-TW">
33
<head>
44
<meta charset="UTF-8" />
55
<meta

js/main.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,4 +378,23 @@
378378
kebbi.addEventListener('touchstart', target);
379379
}
380380

381+
// 處理中間圖片跟隨視窗大小移動位置
382+
function screenRotate() {
383+
const kebbi = document.getElementById('svgKebbi');
384+
const circle = document.querySelector('.circle');
385+
const ww = content.offsetWidth;
386+
const wh = content.offsetHeight;
387+
const ox = (ww - kebbi.offsetWidth) / 2;
388+
const oy = (wh * 0.8 - kebbi.offsetHeight) / 2;
389+
kebbi.style.left = `${ox}px`;
390+
kebbi.style.top = `${oy}px`;
391+
circle.style.width = `${ww * 0.4}px`;
392+
circle.style.height = `${ww * 0.4}px`;
393+
circle.style.left = `${(ww - circle.offsetWidth) / 2}px`;
394+
circle.style.top = `${(wh * 0.8 - circle.offsetHeight) / 2}px`;
395+
}
396+
397+
window.addEventListener('resize', screenRotate);
398+
screenRotate();
399+
381400
}();

0 commit comments

Comments
 (0)