Skip to content

Commit 260bf6f

Browse files
dom_id to tag_id / param
1 parent 8deac38 commit 260bf6f

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

particles.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
/* How to use? : Check the GitHub README
66
/* ----------------------------------------------- */
77

8-
function launchParticlesJS(dom_id, params){
8+
function launchParticlesJS(tag_id, params){
99

1010
/* particles.js variables */
1111
pJS = {
1212
canvas: {
13-
el: document.querySelector('#'+dom_id+' > canvas'),
14-
w: document.querySelector('#'+dom_id+' > canvas').offsetWidth,
15-
h: document.querySelector('#'+dom_id+' > canvas').offsetHeight,
13+
el: document.querySelector('#'+tag_id+' > canvas'),
14+
w: document.querySelector('#'+tag_id+' > canvas').offsetWidth,
15+
h: document.querySelector('#'+tag_id+' > canvas').offsetHeight,
1616
color_hex_bg: '#111',
1717
opacity: 1
1818
},
@@ -231,17 +231,17 @@ function hexToRgb(hex){
231231

232232
/* --- LAUNCH --- */
233233

234-
window.particlesJS = function(dom_id, params){
234+
window.particlesJS = function(tag_id, params){
235235

236236
/* no string id? so it's object params, and set the id with default id */
237-
if(typeof(dom_id) != 'string'){
238-
params = dom_id;
239-
dom_id = 'particles-js';
237+
if(typeof(tag_id) != 'string'){
238+
params = tag_id;
239+
tag_id = 'particles-js';
240240
}
241241

242242
/* no id? set the id to default id */
243-
if(!dom_id){
244-
dom_id = 'particles-js';
243+
if(!tag_id){
244+
tag_id = 'particles-js';
245245
}
246246

247247
/* create canvas element */
@@ -252,11 +252,11 @@ window.particlesJS = function(dom_id, params){
252252
canvas_el.style.height = "100%";
253253

254254
/* append canvas */
255-
var canvas = document.getElementById(dom_id).appendChild(canvas_el);
255+
var canvas = document.getElementById(tag_id).appendChild(canvas_el);
256256

257257
/* launch particle.js */
258258
if(canvas != null){
259-
launchParticlesJS(dom_id, params);
259+
launchParticlesJS(tag_id, params);
260260
}
261261

262262
};

0 commit comments

Comments
 (0)