Skip to content

Commit

Permalink
refactor(scrollspy): remove animejs and add roboto font
Browse files Browse the repository at this point in the history
  • Loading branch information
wuda-io committed Dec 18, 2023
1 parent eb0a8e5 commit c73423e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
6 changes: 4 additions & 2 deletions sass/components/_tooltip.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
.material-tooltip {
// font-family: var(--md-sys-typescale-body-small-font-family-name);
padding: 0 8px;
border-radius: 4px;

background-color: $tooltip-bg-color;
color: $tooltip-font-color;

font-family: var(--md-sys-typescale-body-small-font-family-name);
font-size: var(--md-sys-typescale-body-small-font-size);
line-height: vat(--md-sys-typescale-body-small-line-height);
line-height: var(--md-sys-typescale-body-small-line-height);
font-weight: var(--md-sys-typescale-body-small-font-weight);

min-height: 24px;
opacity: 0;
text-align: center;
Expand Down
13 changes: 1 addition & 12 deletions src/scrollspy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import anim from "animejs";

import { Utils } from "./utils";
import { Component, BaseOptions, InitElements, MElement } from "./component";

Expand Down Expand Up @@ -123,19 +121,10 @@ export class ScrollSpy extends Component<ScrollSpyOptions> {
const trigger = e.target;
for (let i = ScrollSpy._elements.length - 1; i >= 0; i--) {
const scrollspy = ScrollSpy._elements[i];

const x = document.querySelector('a[href="#'+scrollspy.el.id+'"]');
if (trigger === x) {
e.preventDefault();
const offset = ScrollSpy._offset(scrollspy.el).top + 1;

anim({
targets: [document.documentElement, document.body],
scrollTop: offset - scrollspy.options.scrollOffset,
duration: 400,
easing: 'easeOutCubic'
});

scrollspy.el.scrollIntoView({behavior: 'smooth'});
break;
}
}
Expand Down

0 comments on commit c73423e

Please sign in to comment.