alpinejs-scroll-amount
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,1 +0,1 @@ | ||
function t(n){n.magic("scrollAmount",()=>{let o=Math.round(window.scrollY/(document.body.offsetHeight-window.innerHeight)*100);return{px:window.scrollY,percent:o,start:o==0,end:o==100}})}var l=t;export{l as default}; | ||
function t(r){r.magic("scrollAmount",()=>{let o=Math.round(window.scrollY/(document.body.offsetHeight-window.innerHeight)*100);return{scrollPx:window.scrollY,scrollPercent:o,atStart:o==0,atEnd:o==100}})}var e=t;export{e as default}; |
@@ -1,1 +0,1 @@ | ||
(()=>{function o(t){t.magic("scrollAmount",()=>{let n=Math.round(window.scrollY/(document.body.offsetHeight-window.innerHeight)*100);return{px:window.scrollY,percent:n,start:n==0,end:n==100}})}document.addEventListener("alpine:init",()=>{window.Alpine.plugin(o)});})(); | ||
(()=>{function o(t){t.magic("scrollAmount",()=>{let n=Math.round(window.scrollY/(document.body.offsetHeight-window.innerHeight)*100);return{scrollPx:window.scrollY,scrollPercent:n,atStart:n==0,atEnd:n==100}})}document.addEventListener("alpine:init",()=>{window.Alpine.plugin(o)});})(); |
{ | ||
"name": "alpinejs-scroll-amount", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Track the users scroll position and their progress on the page 🤿", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -45,4 +45,4 @@ # Alpine JS Scroll Amount | ||
class="h-px bg-green-500" | ||
:class="{ 'bg-green-600': scrollPos.end }" | ||
:style="{ width: `${scrollPos.percent}%` }" | ||
:class="{ 'bg-green-600': scrollPos.atEnd }" | ||
:style="{ width: `${scrollPos.scrollPercent}%` }" | ||
> | ||
@@ -61,6 +61,6 @@ </span> | ||
return { | ||
px: 0, | ||
percent: 0, | ||
start: true / false, | ||
end: true / false, | ||
scrollPx: 0, | ||
scrollPercent: 0, | ||
atStart: true / false, | ||
atEnd: true / false, | ||
} | ||
@@ -67,0 +67,0 @@ ``` |
@@ -8,8 +8,8 @@ export default function (Alpine) { | ||
return { | ||
px: window.scrollY, | ||
percent: scrollPercent, | ||
start: scrollPercent == 0, | ||
end: scrollPercent == 100, | ||
scrollPx: window.scrollY, | ||
scrollPercent: scrollPercent, | ||
atStart: scrollPercent == 0, | ||
atEnd: scrollPercent == 100, | ||
} | ||
}) | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4563