mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 12:50:01 +00:00
web: tab bar pagination effect & smooth scroll
This commit is contained in:
parent
2ea3ca1a07
commit
95aeec3380
1 changed files with 11 additions and 1 deletions
|
@ -4,13 +4,23 @@
|
|||
export let tabName: string;
|
||||
export let tabLink: string;
|
||||
|
||||
const firstTabs = [
|
||||
"save",
|
||||
"trim",
|
||||
"crop",
|
||||
"convert"
|
||||
];
|
||||
|
||||
let tab: HTMLElement;
|
||||
|
||||
$: isTabActive = $page.url.pathname === tabLink;
|
||||
|
||||
const showTab = (e: HTMLElement | undefined) => {
|
||||
if (e) {
|
||||
e.scrollIntoView({});
|
||||
e.scrollIntoView({
|
||||
inline: firstTabs.includes(tabName) ? 'end' : 'start',
|
||||
behavior: 'smooth'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue