Wrapper: @tsparticles/jquery
Official jQuery plugin wrapper for tsParticles.
Install
bash
pnpm add @tsparticles/jquery @tsparticles/engine @tsparticles/slimQuick setup flow
- Install package and load it in your jQuery setup.
- Initialize features once using slim/all as needed.
- Apply plugin on target element with options.
插件会直接挂载到每个选中的 DOM 元素上,因此元素不需要设置 id:
js
const container = await $(".particles-background").particles().load(options);也可以对同一组元素使用 .ajax(url),从 JSON URL 加载选项。
Monorepo references
- Package folder: https://github.com/tsparticles/tsparticles/tree/main/wrappers/jquery
- Demo app: https://github.com/tsparticles/tsparticles/tree/main/demo/jquery
