Skip to content

Commit fefae8b

Browse files
authored
Merge pull request creotip#21 from xkisu/master
Added support for multiple particles on a single page
2 parents 0933265 + 1659b66 commit fefae8b

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
text-align: center;
145145
}
146146
147-
#particles-js {
147+
.particles-js {
148148
background-image: url("./assets/sky.jpg");
149149
background-size: cover;
150150
position: absolute;

src/vue-particles/vue-particles.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<template>
22
<div
3-
id="particles-js"
3+
class="particles-js"
4+
:id="id"
45
:color="color"
56
:particleOpacity="particleOpacity"
67
:linesColor="linesColor"
@@ -22,6 +23,11 @@
2223
/* eslint-disable */
2324
export default {
2425
name: 'vue-particles',
26+
data: function () {
27+
return {
28+
id: 'particles-instance-' + Math.floor(Math.random() * 5000)
29+
}
30+
},
2531
props: {
2632
color: {
2733
type: String,
@@ -125,7 +131,7 @@
125131
clickEffect,
126132
clickMode
127133
) {
128-
particlesJS('particles-js', {
134+
particlesJS(this.id, {
129135
"particles": {
130136
"number": {
131137
"value": particlesNumber,

0 commit comments

Comments
 (0)