mirror of
https://github.com/imputnet/cobalt.git
synced 2024-12-29 11:06: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 tabName: string;
|
||||||
export let tabLink: string;
|
export let tabLink: string;
|
||||||
|
|
||||||
|
const firstTabs = [
|
||||||
|
"save",
|
||||||
|
"trim",
|
||||||
|
"crop",
|
||||||
|
"convert"
|
||||||
|
];
|
||||||
|
|
||||||
let tab: HTMLElement;
|
let tab: HTMLElement;
|
||||||
|
|
||||||
$: isTabActive = $page.url.pathname === tabLink;
|
$: isTabActive = $page.url.pathname === tabLink;
|
||||||
|
|
||||||
const showTab = (e: HTMLElement | undefined) => {
|
const showTab = (e: HTMLElement | undefined) => {
|
||||||
if (e) {
|
if (e) {
|
||||||
e.scrollIntoView({});
|
e.scrollIntoView({
|
||||||
|
inline: firstTabs.includes(tabName) ? 'end' : 'start',
|
||||||
|
behavior: 'smooth'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue