粒子不是从particles.js生成的(Particles are not being generated from particles.js)
我一直在试图在我的网站上实现particles.js,但没有生成粒子。 所以我从github页面下载了这个demo,然后打开index.html,但它仍然不会生成粒子。 可能是什么问题? 如果我去样品现场 ,那里产生的粒子就完美了。
这里是index.html:
<body> <div id="particles-js"></div> <!-- Hero --> <div class="hero"> <ul class="fly-in-header hidden"> <li>TIRTH </li> <li>THE </li> <li>ARTIST</li> </ul> <b1> <a href="photography.html"><button type="button" id="main-button" class="btn btn-outline-secondary">photography</button></a> <a href="projects.html"><button type="button" id="main-button" class="btn btn-outline-secondary">projects</button></a> </b1> </div> <!-- jQuery first, then Tether, then Bootstrap JS. --> <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script> <script src="js/particles.js"></script> <script src="js/apps.js"></script> <script type="text/javascript"> $(function() { setTimeout(function() { $('.hero > .fly-in-header').removeClass('hidden'); }, 500); })(); </script> </body>
apps.js:
particlesJS.load('particles-js', { "particles": { "number": { "value": 80, "density": { "enable": true, "value_area": 800 } }, "color": { "value": "#000000" }, "shape": { "type": "circle", "stroke": { "width": 0, "color": "#000000" }, "polygon": { "nb_sides": 5 }, "image": { "src": "img/github.svg", "width": 100, "height": 100 } }, "opacity": { "value": 0.5, "random": false, "anim": { "enable": false, "speed": 1, "opacity_min": 0.1, "sync": false } }, "size": { "value": 3, "random": true, "anim": { "enable": false, "speed": 40, "size_min": 0.1, "sync": false } }, "line_linked": { "enable": true, "distance": 150, "color": "#000000", "opacity": 0.4, "width": 1 }, "move": { "enable": true, "speed": 6, "direction": "none", "random": false, "straight": false, "out_mode": "out", "bounce": false, "attract": { "enable": false, "rotateX": 600, "rotateY": 1200 } } }, "interactivity": { "detect_on": "canvas", "events": { "onhover": { "enable": true, "mode": "repulse" }, "onclick": { "enable": false, "mode": "push" }, "resize": true }, "modes": { "grab": { "distance": 400, "line_linked": { "opacity": 1 } }, "bubble": { "distance": 400, "size": 40, "duration": 2, "opacity": 8, "speed": 3 }, "repulse": { "distance": 100, "duration": 0.4 }, "push": { "particles_nb": 4 }, "remove": { "particles_nb": 2 } } }, "retina_detect": true } );
I have been trying to implement particles.js into my website however there were no particles being generated. So I downloaded the demo from the github page and just opened index.html but it still doesn't generate particles. What could be the issue? If I go to the sample site, particles are generated there perfectly fine.
Here is index.html:
<body> <div id="particles-js"></div> <!-- Hero --> <div class="hero"> <ul class="fly-in-header hidden"> <li>TIRTH </li> <li>THE </li> <li>ARTIST</li> </ul> <b1> <a href="photography.html"><button type="button" id="main-button" class="btn btn-outline-secondary">photography</button></a> <a href="projects.html"><button type="button" id="main-button" class="btn btn-outline-secondary">projects</button></a> </b1> </div> <!-- jQuery first, then Tether, then Bootstrap JS. --> <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script> <script src="js/particles.js"></script> <script src="js/apps.js"></script> <script type="text/javascript"> $(function() { setTimeout(function() { $('.hero > .fly-in-header').removeClass('hidden'); }, 500); })(); </script> </body>
apps.js:
particlesJS.load('particles-js', { "particles": { "number": { "value": 80, "density": { "enable": true, "value_area": 800 } }, "color": { "value": "#000000" }, "shape": { "type": "circle", "stroke": { "width": 0, "color": "#000000" }, "polygon": { "nb_sides": 5 }, "image": { "src": "img/github.svg", "width": 100, "height": 100 } }, "opacity": { "value": 0.5, "random": false, "anim": { "enable": false, "speed": 1, "opacity_min": 0.1, "sync": false } }, "size": { "value": 3, "random": true, "anim": { "enable": false, "speed": 40, "size_min": 0.1, "sync": false } }, "line_linked": { "enable": true, "distance": 150, "color": "#000000", "opacity": 0.4, "width": 1 }, "move": { "enable": true, "speed": 6, "direction": "none", "random": false, "straight": false, "out_mode": "out", "bounce": false, "attract": { "enable": false, "rotateX": 600, "rotateY": 1200 } } }, "interactivity": { "detect_on": "canvas", "events": { "onhover": { "enable": true, "mode": "repulse" }, "onclick": { "enable": false, "mode": "push" }, "resize": true }, "modes": { "grab": { "distance": 400, "line_linked": { "opacity": 1 } }, "bubble": { "distance": 400, "size": 40, "duration": 2, "opacity": 8, "speed": 3 }, "repulse": { "distance": 100, "duration": 0.4 }, "push": { "particles_nb": 4 }, "remove": { "particles_nb": 2 } } }, "retina_detect": true } );
原文:https://stackoverflow.com/questions/45423596
最满意答案
我不知道为什么会发生这种情况,但解决问题的一种方法是进入您的构建设置并将框架搜索路径定义到包含相关框架的文件夹中。 如果框架放在项目目录中,只需将框架搜索路径设置为
$(SRCROOT)
,并将其设置为递归。I'm not sure why this happens, but one way to solve your issue is to go into your build settings and defining the Framework Search Paths to a folder which contains the frameworks in question. If the frameworks are placed in your project directory, simply set the framework search path to
$(SRCROOT)
and set it to recursive.
相关问答
更多-
替换你的Podfile如下: platform :ios, '9.0' target 'RxStudy' do use_frameworks! pod 'RxSwift' pod 'RxCocoa' target 'RxStudyTests' do #Add pod here if you want the access of pod in Tests target. #Example: pod 'RxSwift' end ...
-
从Swift 2.2开始,您可以使用swiftc直接从命令行编译swiftmodule ,使用-emit-module标志,如下所示: $ swiftc -emit-module MyClass.swift $ ls MyClass.swift MyClass.swiftdoc MyClass.swiftmodule 使用--help标志查看完整的选项列表。 另请参阅创建纯Swift模块博客文章以获取更完整的教程。 Apple Swift version 2.2 (swiftlang-703.0.18.1 ...
-
获取错误“没有这样的模块”使用Xcode,但框架是在那里(Getting error “No such module” using Xcode, but the framework is there)[2023-07-13]
我不知道为什么会发生这种情况,但解决问题的一种方法是进入您的构建设置并将框架搜索路径定义到包含相关框架的文件夹中。 如果框架放在项目目录中,只需将框架搜索路径设置为$(SRCROOT) ,并将其设置为递归。 I'm not sure why this happens, but one way to solve your issue is to go into your build settings and defining the Framework Search Paths to a folder whi ... -
找到了解决办法。 从App Store下载新的Xcode6版本。 Xcode 6.0.1(6A317) ,它可以在所有设备和模拟器上运行。 (没有通知更新Xcode,您必须搜索并下载新版本) Found a fix. Downloaded the new Xcode6 version from the App Store. Xcode 6.0.1 (6A317) and it runs on all devices and simulators. (There was no notification to ...
-
建立该项目。 Xcode编辑器无法识别来自Pod的模块,直到它们首次构建完成。 如果这不适合你,请分享一个问题的屏幕截图,或者更好的,一个可重复的例子。 Build the project. The Xcode editor doesn't recognize modules coming from the Pods until after they've been built for the first time. If that doesn't work for you, please share a ...
-
我现在感觉非常愚蠢。 我认为默认的访问级别对我的框架中定义的所有内容都是公开的。 我可以通过公开课程和初始值设定项来解决这个问题。 I feel very dumb right now. I thought that the default access level was public for everything defined in my Framework. I was able to fix this issue by making the class and the initializer pu ...
-
我找到了答案:在TransportLayer目标中打开Build Phases并手动将PersistenceLayer和Socket添加到Target Dependencies 。 这确保了TransportLayer依赖的任何东西都将在它之前构建。 我有一种预感, iOS Device方案正在起作用的原因是我删除了有问题的文件,允许一切正常构建,包括缓存的PersistenceLayer 。 将导入添加回项目后,它继续工作,因为不再需要构建PersistenceLayer 。 其他方案不起作用,因为Per ...
-
Xcode,没有这样的模块(Xcode, No such Module)[2022-09-05]
我通过单独构建pods-projectname文件解决了这个问题 编辑方案 从左侧列表中选择build 添加pods-projectname 按关闭然后构建以测试pods-projectname文件。 I solved the problem by building my pods-projectname file separately edit scheme choose build from the list on the left add pods-projectname press close an ... -
# Uncomment this line to define a global platform for your project platform :ios, '9.0' # Comment this line if you're not using Swift and don't want to use dynamic frameworks use_frameworks! # Pods for Promposal target 'Promposal' do pod 'Fireb ...
-
Cocoa框架应该是#import而不是#include 。 但是,#import需要Objective-C文件(.m)。 Cocoa frameworks should be #import'd rather than #include'd. However, #import requires an Objective-C file (.m).