Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update(examples): optimize the user experience of expanding and colla…
Browse files Browse the repository at this point in the history
…psing demo-block.
kohaiy authored Jan 13, 2024
1 parent 19f7c8e commit 250e0ec
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion examples/src/comp/demo-block.vue
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@
class="demo-block-control"
:style="{ width: getDemoBlockControlWidth }"
:class="{ 'is-fixed': fixedControl }"
@click="isExpanded = !isExpanded"
@click="handleChangeExpand"
>
<i
:class="['arraw-slide-icon', iconClass, { hovering: hovering }]"
@@ -172,6 +172,16 @@ export default {
this.isDemoRendered = true;
}
},
handleChangeExpand() {
this.isExpanded = !this.isExpanded
if (!this.isExpanded && this.$refs.meta) {
const height = this.$refs.meta.getBoundingClientRect().height
window.scrollTo({
top: window.scrollY - height,
behavior: 'instant',
})
}
},
// scroll handler
scrollHandler() {
const { top, bottom, left } =

0 comments on commit 250e0ec

Please sign in to comment.