Scroll the now line into view on navigation
When displaying the schedule, scroll it such that the now line is on the left to make what is displayed by default the most immediately useful information.
This commit is contained in:
parent
ae1c653af6
commit
9013e85ff0
2 changed files with 16 additions and 1 deletions
|
@ -77,6 +77,7 @@
|
|||
<td :colSpan="totalColumns">
|
||||
<div
|
||||
v-if="nowOffset !== undefined"
|
||||
ref="nowLine"
|
||||
class="now"
|
||||
:style="` --now-offset: ${nowOffset}`"
|
||||
>
|
||||
|
@ -677,6 +678,16 @@ const nowOffset = computed(() => {
|
|||
offset += group.width;
|
||||
}
|
||||
});
|
||||
|
||||
const nowLine = useTemplateRef("nowLine"); // If I name the ref now, the element disappears?!
|
||||
function scrollToNow() {
|
||||
if (nowLine.value) {
|
||||
nowLine.value.scrollIntoView({ behavior: "smooth", inline: "start", block: "nearest" });
|
||||
}
|
||||
}
|
||||
defineExpose({
|
||||
scrollToNow,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue