marcbruederlin / particles.js

A lightweight, dependency-free and responsive javascript plugin for particle backgrounds.

Home Page:https://marcbruederlin.github.io/particles.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Particles squeezed on top on mobile devices

riccardoratta opened this issue · comments

When I load the script on a mobile device with Google Chrome (I've not tested on other browsers) the particles are squeezed on top.

screen shot 2018-04-20 at 20 28 54

But after a change of resolution (without reloading the page):

screen shot 2018-04-20 at 20 30 59

The code in the page:

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Title</title>
  </head>
  <body>

    <style>
    .background {
      position: absolute;
      display: block;
      top: 0;
      left: 0;
      z-index: -1;
      background-color: #222;
    }
    </style>

    <canvas class="background"></canvas>
    <script src="scripts/particles.min.js"></script>
    <script>
      window.onload = function() {
        Particles.init({
          maxParticles: 50,
          selector: '.background',
          color: '#ffffff',
          connectParticles: true,
        });
      };
    </script>
  </body>
</html>

It was the meta viewport, replace it to solve the problem.

<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, maximum-scale=1.0">