Skip to content

Commit 67618ed

Browse files
committed
✨ 优化文章菜单按钮与内容的布局
1 parent 831f2d9 commit 67618ed

File tree

6 files changed

+35
-62
lines changed

6 files changed

+35
-62
lines changed

assets/dist/js/libs.min.js

Lines changed: 3 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/dist/js/puock.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/dist/style/libs.min.css

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/dist/style/style.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/puock.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class Puock {
1212

1313
data = {
1414
tag: 'puock',
15+
pc:true,
1516
params: {
1617
home: null,
1718
use_post_menu: false,
@@ -82,6 +83,8 @@ class Puock {
8283
this.eventPostMainBoxResize()
8384
this.swiperOnceEvent()
8485
this.initModalToggle()
86+
this.detectDevice()
87+
window.addEventListener('resize', ()=>this.detectDevice());
8588
layer.config({shade: 0.5})
8689
console.log("\n %c Puock Theme %c https://github.com/Licoy/wordpress-theme-puock \n\n",
8790
"color:#f1ab0e;background:#030307;padding:5px 0;border-top-left-radius:8px;border-bottom-left-radius:8px",
@@ -121,6 +124,11 @@ class Puock {
121124
return e.currentTarget
122125
}
123126

127+
detectDevice() {
128+
const screenWidth = window.innerWidth;
129+
this.data.pc = screenWidth >= 768
130+
}
131+
124132
initBasicDOMEvent() {
125133
// el show or hide event
126134
$(document).on("click", ".toggle-el-show-hide", (e) => {
@@ -370,6 +378,9 @@ class Puock {
370378
duration: 50,
371379
easing: "swing"
372380
});
381+
if(!this.data.pc){
382+
this.toggleMenu()
383+
}
373384
return false;
374385
});
375386
}

assets/style/style.less

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,9 @@ body.pre-mac pre {
453453
#post-menus {
454454
user-select: none;
455455
position: fixed;
456-
right: auto;
457-
left: 10px;
458-
bottom: 100px;
456+
left: auto;
457+
right: 47px;
458+
bottom: 170px;
459459
top: auto;
460460
z-index: 999;
461461

@@ -467,9 +467,9 @@ body.pre-mac pre {
467467
}
468468

469469
#post-menu-state {
470-
border-radius: 10px 0 0 10px; // 展开时改变按钮圆角,只保留左侧圆角
471-
border-right: none; // 去掉右边框
472-
left: 0; // 保持在左侧
470+
border-radius: 0 10px 10px 0; // 展开时改变按钮圆角,只保留左侧圆角
471+
border-left: none; // 去掉右边框
472+
right: 0; // 保持在左侧
473473
box-shadow: none; // 去掉阴影
474474
border-color: transparent; // 边框透明
475475
}
@@ -508,13 +508,13 @@ body.pre-mac pre {
508508
#post-menu-content {
509509
position: absolute;
510510
bottom: 0; // 底部对齐
511-
left: 40px; // 位于按钮右侧
511+
left: -260px; // 位于按钮右侧
512512
width: 260px;
513513
max-height: 400px;
514514
height: auto;
515515
padding: 15px;
516516
overflow-y: auto;
517-
border-radius: 10px 10px 10px 0;
517+
border-radius: 10px 10px 0 10px;
518518
background-color: var(--pk-bg-box);
519519
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
520520
transform: translateX(-20px) scale(0.9);

0 commit comments

Comments
 (0)