Я пытаюсь реализовать эффект частиц на моем проекте ruby on rails, но после выполнения некоторых учебных пособий и инструкций по набору частиц github я не получаю эффекта от своих локальных сервер, даже если я задаю серый фон. Может быть, вы можете указать, какая из них - моя ошибка или что мне не хватает. Вот мой код.Частица Js, не работающая над моим ruby on rails project
application.js
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require particles.js
//= require app.js
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
Application.css
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require_tree .
*= require_self
*/
back.css
#particles-js{
backgorund: #444;
}
home.html.erb
<h1>Rubsol#home</h1>
<p>Find me in app/views/rubsol/home.html.erb</p>
<div id="particles-js"></div>
Я не прикладывая линии
<script src="particles.js"></script>
<script src="particles.js"></script>
, потому что я думаю, что они не нужны, так как я использую // = require_tree, но я также попытался положить их, и это ничего не показывает.
back.css был создан только для того, чтобы установить цвет backgorund эффекта частиц, и я не размещаю содержимое particle.js и app.js, потому что я ничего не менял из этих файлов, они те же, которые вы можете скачать из github.
https://github.com/VincentGarreau/particles.js/
Вот что я получаю:
не забудьте проверить консоль javascript на наличие ошибок –
, но если у меня возникла проблема с javascript, у меня не было бы результата, и я не изменил бы файлы js. – jportella
Довольно уверен, что он все равно покажет ваш HTML в этом случае –