mirror of
https://github.com/imputnet/cobalt.git
synced 2024-12-28 02:26:10 +00:00
web: tab bar pagination effect & smooth scroll
This commit is contained in:
parent
2ea3ca1a07
commit
95aeec3380
|
@ -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