Skip to content

Commit 6fb1d0a

Browse files
committed
Update apis.select.html of Edge
1 parent 9bfe693 commit 6fb1d0a

File tree

1 file changed

+34
-6
lines changed

1 file changed

+34
-6
lines changed

edge/apis.select.html

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ <h4>赋值</h4>
107107

108108
<h4>剪裁、滚动与定位</h4>
109109

110-
<p>测试祖先容器存在 <code>overflow:hidden</code> 声明,会不会剪裁下拉列表:</p>
110+
<p>测试祖先容器存在 <code>overflow:hidden</code> 声明,会不会剪裁下拉列表(支持popover属性的浏览器不会剪裁)</p>
111111

112112
<div id="x1" style="overflow: hidden; padding-bottom: 12px; position: relative;">
113113
看看剪裁没?<select is="ui-select">
@@ -117,7 +117,9 @@ <h4>剪裁、滚动与定位</h4>
117117
</select>
118118
</div>
119119

120-
<p>局部滚动定位测试(水平滚动试试):</p>
120+
<h5>局部滚动定位问题演示</h5>
121+
122+
<p>请展开下拉,然后水平或垂直滚动试试:</p>
121123
<style>.scroll-sel { width: 300px; height: 100px; border: 1px dotted; overflow: auto; transform: scale(1); text-align: center; }</style>
122124
<div class="scroll-sel">
123125
<div style="width: 600px;">&nbsp;</div>
@@ -126,13 +128,37 @@ <h4>剪裁、滚动与定位</h4>
126128
<option value="2">选项2</option>
127129
<option value="3">选项3</option>
128130
</select>
131+
<div style="height: 190px;"></div>
129132
</div>
130133

131-
<p>如果希望下拉内容在局部滚动容器内部,可以设置<code>data-css-position="true"</code>或者设置<code>is-css-position</code>属性,例如:</p>
132-
<pre>&lt;select data-css-position="true" is="ui-select"&gt;</pre>
133-
<pre>&lt;select is-css-position is="ui-select"&gt;</pre>
134+
<p>可以看到下拉列表和点击按钮分离了。</p>
135+
136+
<h5>局部滚动跟随实现</h5>
137+
138+
<p>两种方法。</p>
139+
<p>其一,使用CSS锚点定位,可以设置<code>data-anchor="true"</code>或者设置<code>is-anchor</code>属性。代码和效果示意如下:</p>
140+
<pre>&lt;select data-anchor="true" is="ui-select"&gt;
141+
&lt;select is-anchor is="ui-select"&gt;</pre>
142+
<div class="scroll-sel">
143+
<div style="width: 600px;">&nbsp;</div>
144+
<select data-anchor="true" is="ui-select">
145+
<option value="1">选项1</option>
146+
<option value="2">选项2</option>
147+
<option value="3">选项3</option>
148+
</select>
149+
<select is-anchor is="ui-select">
150+
<option value="1">选项1</option>
151+
<option value="2">选项2</option>
152+
<option value="3">选项3</option>
153+
</select>
154+
<div style="height: 150px;"></div>
155+
</div>
156+
157+
<p>其二,采用CSS定位,让下拉内容在局部滚动容器内部,可以设置<code>data-css-position="true"</code>或者设置<code>is-css-position</code>属性,例如:</p>
158+
<pre>&lt;select data-css-position="true" is="ui-select"&gt;
159+
&lt;select is-css-position is="ui-select"&gt;</pre>
134160
<div class="scroll-sel">
135-
<div style="height: 20px;"></div>
161+
<div style="width: 600px;">&nbsp;</div>
136162
<select data-css-position="true" is="ui-select">
137163
<option value="1">选项1</option>
138164
<option value="2">选项2</option>
@@ -146,6 +172,8 @@ <h4>剪裁、滚动与定位</h4>
146172
<div style="height: 150px;"></div>
147173
</div>
148174

175+
<p>注意,如果CSS定位和锚点定位同时设置,以CSS定位为准。</p>
176+
149177
<h4>分组</h4>
150178

151179
<p>支持 <code>&lt;optgroup&gt;</code> 元素分组。</p>

0 commit comments

Comments
 (0)