vhAstro-Theme/src/scripts/LivePhoto.ts
2025-03-19 20:05:47 +08:00

15 lines
566 B
TypeScript

// SmoothScroll 滚动优化
import { LoadScript } from "../utils/index";
declare const LivePhotosKit: any;
export default async () => {
const livePhotoList = document.querySelectorAll('.vh-node.vh-vhLivePhoto');
if (!livePhotoList.length) return;
await LoadScript("/assets/js/livephotoskit.js");
livePhotoList.forEach((i: any) => {
const { photo, video } = i.dataset;
i.innerHTML = `<div class="live-raw"></div>`
const player = LivePhotosKit.Player(i.querySelector('.live-raw'));
player.photoSrc = photo;
player.videoSrc = video;
})
};