Skip to content

Commit cb18803

Browse files
author
Nii Yeboah
committed
Add smooth scroll property
1 parent 74359f6 commit cb18803

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@
4545
"dependencies": {
4646
"@juggle/resize-observer": "^3.1.3",
4747
"@polymer/polymer": "^3.0.0",
48-
"@vaadin/component-base": "^23.2.4",
49-
"@vaadin/tabs": "^23.2.4",
50-
"@vaadin/vaadin-lumo-styles": "^23.2.4",
51-
"@vaadin/vaadin-themable-mixin": "^23.2.4",
48+
"@vaadin/component-base": "^23.2.8",
49+
"@vaadin/tabs": "^23.2.8",
50+
"@vaadin/vaadin-lumo-styles": "^23.2.8",
51+
"@vaadin/vaadin-themable-mixin": "^23.2.8",
5252
"intersection-observer": "^0.10.0",
5353
"smoothscroll-polyfill": "^0.4.4",
5454
"stickyfilljs": "^2.1.0"

src/vcf-anchor-nav.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,15 @@ export class AnchorNavElement extends ElementMixin(ThemableMixin(PolymerElement)
188188
disablePreserveOnRefresh: {
189189
type: Boolean,
190190
value: false
191+
},
192+
193+
/**
194+
* Set true to enable smooth scroll animation on tab clicks.
195+
* @type {Boolean}
196+
*/
197+
smoothScroll: {
198+
type: Boolean,
199+
value: true
191200
}
192201
};
193202
}
@@ -323,9 +332,7 @@ export class AnchorNavElement extends ElementMixin(ThemableMixin(PolymerElement)
323332
_initTab(tab, section) {
324333
tab.id = tab.id || section.defaultTabId;
325334
tab.setAttribute('part', 'tab');
326-
tab.addEventListener('click', () => {
327-
this._scrollToSection(section.id, false, this._deepLinks);
328-
});
335+
tab.addEventListener('click', () => this._scrollToSection(section.id, this.smoothScroll, this._deepLinks));
329336
this._setTabAnchor(tab, section);
330337
}
331338

0 commit comments

Comments
 (0)