✌️
This commit is contained in:
parent
a2f16c1364
commit
a7dd3e9324
@ -90,17 +90,26 @@ export function scrollToTop(el: HTMLElement, options: { behavior?: ScrollBehavio
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Scroll to Bottom
|
* Scroll to Bottom
|
||||||
|
* 通常のページで ウィジェット高さ > コンテンツ高さ の場合にうまく動くように
|
||||||
|
* 若干処理が複雑になっている
|
||||||
* @param el Content element
|
* @param el Content element
|
||||||
* @param options Scroll options
|
* @param options Scroll options
|
||||||
* @param container Scroll container element
|
* @param container Scroll container element
|
||||||
* @param addSticky To add sticky-top or not
|
* @param sticky To add sticky-top
|
||||||
|
* @param mobileButtons To add mobile buttons
|
||||||
*/
|
*/
|
||||||
export function scrollToBottom(el: HTMLElement, options: ScrollToOptions = {}, container = getScrollContainer(el), addSticky: boolean = true) {
|
export function scrollToBottom(
|
||||||
const addStickyTop = addSticky ? getStickyTop(el, container) : 0;
|
el: HTMLElement,
|
||||||
|
options: ScrollToOptions = {},
|
||||||
|
container = getScrollContainer(el),
|
||||||
|
) {
|
||||||
if (container) {
|
if (container) {
|
||||||
container.scroll({ top: el.scrollHeight - container.clientHeight + addStickyTop || 0, ...options });
|
container.scroll({ top: el.scrollHeight - container.clientHeight + getStickyTop(el, container) || 0, ...options });
|
||||||
} else {
|
} else {
|
||||||
window.scroll({ top: el.scrollHeight - window.innerHeight + addStickyTop || 0, ...options });
|
window.scroll({
|
||||||
|
top: (el.scrollHeight - window.innerHeight + getStickyTop(el, container) + (window.innerWidth <= 500 ? 96 : 0)) || 0,
|
||||||
|
...options
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user