Skip to content

Commit 93befea

Browse files
Copilotruibaby
andcommitted
Changes before error encountered
Co-authored-by: ruibaby <[email protected]>
1 parent d43f844 commit 93befea

File tree

1 file changed

+33
-5
lines changed

1 file changed

+33
-5
lines changed

packages/search-widget/index.html

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,44 @@
4646
</style>
4747
</head>
4848
<body>
49-
<button>启动</button>
50-
<button id="color">暗色/亮色</button>
49+
<h1>Search Widget Demo</h1>
50+
51+
<div>
52+
<button id="open-default">Open Modal (Default - Lock Scroll)</button>
53+
<button id="open-no-lock">Open Modal (No Lock Scroll)</button>
54+
<button id="color">Toggle Dark/Light Mode</button>
55+
</div>
56+
57+
<div style="margin-top: 2rem;">
58+
<h2>Configuration Examples</h2>
59+
<p>Default behavior (lockScroll = true): Page scrollbar is hidden when modal opens</p>
60+
<p>With lockScroll = false: Page scrollbar remains visible, preventing page jitter</p>
61+
</div>
62+
63+
<div style="margin-top: 2rem;">
64+
<h3>Long content to enable scrolling</h3>
65+
<div style="height: 2000px; background: linear-gradient(to bottom, #f0f0f0, #ffffff);">
66+
<p>Scroll down to see the scrollbar...</p>
67+
</div>
68+
</div>
69+
5170
<search-modal></search-modal>
5271
</body>
5372
<script>
54-
const button = document.querySelector('button');
73+
const openDefaultBtn = document.getElementById('open-default');
74+
const openNoLockBtn = document.getElementById('open-no-lock');
5575
const searchModal = document.querySelector('search-modal');
5676

57-
button.addEventListener('click', () => {
58-
searchModal.open = !searchModal.open;
77+
// Open with default lockScroll (true)
78+
openDefaultBtn.addEventListener('click', () => {
79+
searchModal.lockScroll = true;
80+
searchModal.open = true;
81+
});
82+
83+
// Open with lockScroll = false
84+
openNoLockBtn.addEventListener('click', () => {
85+
searchModal.lockScroll = false;
86+
searchModal.open = true;
5987
});
6088

6189
const color = document.getElementById('color');

0 commit comments

Comments
 (0)