Skip to content

Commit

Permalink
pixel-perfect: scroll-selector attr
Browse files Browse the repository at this point in the history
  • Loading branch information
denisavitski committed Jan 16, 2025
1 parent 05ca9e3 commit 5c24daf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aptechka",
"version": "0.51.6",
"version": "0.51.7",
"repository": {
"type": "git",
"url": "git+https://github.com/denisavitski/aptechka.git"
Expand Down
8 changes: 7 additions & 1 deletion src/components/packages/pixel-perfect/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ export class PixelPerfectElement extends HTMLElement {
}

protected connectedCallback() {
this.#scrollParentElement = findScrollParentElement(this)
const scrollSelector = this.getAttribute('scroll-selector')

if (scrollSelector) {
this.#scrollParentElement = document.querySelector(scrollSelector)
} else {
this.#scrollParentElement = findScrollParentElement(this)
}

this.#scrollParentElement?.addEventListener('scroll', this.#scrollListener)

Expand Down

0 comments on commit 5c24daf

Please sign in to comment.