Skip to content

Commit

Permalink
Merge pull request #43 from UXCorpRangel/fix/oneko-mobile
Browse files Browse the repository at this point in the history
fix: remove oneko in mobile devices
  • Loading branch information
jagcruz authored Nov 8, 2024
2 parents 85b26c1 + 8dd7f2b commit 59c64df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ import Team from '@sections/Team.astro';
</style>

<script>
import HarleyOneko from '@scripts/harley-oneko';
const isHoverDevice = window.matchMedia('(any-hover: hover)').matches;

new HarleyOneko('/assets/images/harley-oneko.png');
if (isHoverDevice) {
import('@scripts/harley-oneko').then(HarleyOneko => {
new HarleyOneko.default('/assets/images/harley-oneko.png');
});
}
</script>
2 changes: 1 addition & 1 deletion src/scripts/harley-oneko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export default class HarleyOneko {

document.body.appendChild(this.onekoEl);

document.addEventListener('mousemove', event => {
document.addEventListener('pointermove', (event: MouseEvent) => {
this.mousePosX = event.clientX;
this.mousePosY = event.clientY;
this.onekoEl.style.zIndex = '2147483647';
Expand Down

0 comments on commit 59c64df

Please sign in to comment.