Skip to content

Commit 4c33ca7

Browse files
committed
fix theme button on mobile
1 parent e9c9091 commit 4c33ca7

3 files changed

Lines changed: 28 additions & 5 deletions

File tree

‎docs/css/style.css‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ pre {
162162
opacity: 1;
163163
}
164164

165+
#theme-toggle:not(.demo) {
166+
margin-right: 40px;
167+
}
168+
165169
/* Mobile Styles - Changed breakpoint from 768px to 1024px */
166170
@media (max-width: 1024px) {
167171
/* Show mobile menu button */
@@ -193,16 +197,17 @@ pre {
193197
}
194198

195199
/* Adjust theme toggle button position on mobile */
196-
#theme-toggle {
200+
#theme-toggle:not(.demo) {
197201
position: fixed;
202+
margin-right: 0;
198203
top: 16px;
199-
right: 16px;
204+
right: 80px;
200205
z-index: 9998;
201206
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
202207
background-color: var(--background-color);
203208
}
204209

205-
.dark #theme-toggle {
210+
.dark #theme-toggle:not(.demo) {
206211
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
207212
}
208213

@@ -241,6 +246,13 @@ pre {
241246
}
242247
}
243248

249+
@media (max-width: 768px) {
250+
/* When github corner is invisible */
251+
#theme-toggle:not(.demo) {
252+
right: 16px;
253+
}
254+
}
255+
244256
/* Prevent body scroll when mobile menu is open */
245257
body.mobile-menu-open {
246258
overflow: hidden;

‎docs/demo/demo.css‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ header h1 {
6262

6363

6464
.theme-toggle {
65-
margin-left: 16px;
65+
margin-inline: 16px 60px;
6666
display: flex;
6767
align-items: center;
6868
gap: 8px;
@@ -78,6 +78,13 @@ header h1 {
7878
transition: background-color 0.2s ease, color 0.2s ease;
7979
}
8080

81+
@media (max-width: 768px) {
82+
/* When github corner is invisible */
83+
.theme-toggle {
84+
margin-right: 0;
85+
}
86+
}
87+
8188
.theme-toggle:hover {
8289
background-color: var(--code-bg-color);
8390
color: var(--text-color);
@@ -87,6 +94,10 @@ header h1 {
8794
font-size: 20px;
8895
}
8996

97+
@media screen {
98+
99+
}
100+
90101
.containers {
91102
display: flex;
92103
height: calc(100vh - 68px);

‎docs/demo/index.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ <h1>Marked Demo</h1>
8181
<span class="separator">·</span>
8282
<a href="https://daringfireball.net/projects/markdown/dingus">Daring Fireball Demo</a>
8383
</div>
84-
<button id="theme-toggle" class="theme-toggle" data-theme-mode="system" aria-label="Switch theme">
84+
<button id="theme-toggle" class="theme-toggle demo" data-theme-mode="system" aria-label="Switch theme">
8585
<span class="material-icons" data-theme-icon>brightness_auto</span>
8686
<span class="text" data-theme-text>System</span>
8787
</button>

0 commit comments

Comments
 (0)