mirror of
https://github.com/wukko/cobalt.git
synced 2025-02-28 22:18:48 +01:00
web: tab bar pagination effect & smooth scroll
This commit is contained in:
parent
fa37cfe968
commit
5322b69e6c
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