Skip to content

Commit f6690c8

Browse files
author
Jihye Hong
committed
[css-nav-1] Add an example for spatialNavigationSearch with 'inside' attribute
1 parent ec9ac99 commit f6690c8

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

css-nav-1/Overview.bs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,32 @@ and the result will be <code>null</code>.</em>
624624
</div>
625625
</div>
626626

627+
<div class=example id=searchInside>
628+
This example shows how the different result of {{Element/spatialNavigationSearch()}}
629+
depending on the value of {{SpatialNavigationSearchOptions/inside}} attribute.
630+
631+
When the page has the code snippet as below,
632+
633+
<pre><code highlight=markup>
634+
&lt;body>
635+
&lt;div id="container" style="width:300px; height:200px; overflow-x: scroll;">
636+
&lt;button id="button1">&lt;/button>
637+
&lt;/div>
638+
&lt;button id="button2">&lt;/button>
639+
&lt;/body>
640+
</code></pre>
641+
642+
<pre><code highlight=javascript>
643+
const container = document.getElementById('container');
644+
645+
const insideBtn = container.spatialNavigationSearch('right', {inside: true});
646+
const outsideBtn = container.spatialNavigationSearch('right');
647+
</code></pre>
648+
649+
<code>insideBtn</code> is assigned to the element whose {{Element/id}} matches with <code>'button1'</code>.
650+
But <code>outsideBtn</code> is the element with {{Element/id}} <code>'button2'</code>.
651+
</div>
652+
627653
<div class=api>
628654
<h2 id="events-navigationevent">
629655
Navigation Events</h2>

0 commit comments

Comments
 (0)