2015-12-09 177 views
0

我有一个模板,我已经安装了,除了一些javascript之外,一切都正常工作,但是当我检查javascript的编译列表时,我看到所有文件都已加载,并且CSS具有所有正确的文件。排除故障并找出如何让js加载并确定问题的最佳方法是什么?插件不能在rails上工作4

这里是我的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 vendor/assets/javascripts of plugins, if any, 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/sstephenson/sprockets#sprockets-directives) for details 
// about supported directives. 
// 
//= require jquery 
//= require jquery_ujs 
//= require jquery.purr 
//= require best_in_place 
//= require bootstrap 
//= require turbolinks 
//= require js/template 
//= require bootstrap/js/bootstrap 
//= require plugins/rs-plugin/js/jquery.themepunch.revolution 
//= require plugins/rs-plugin/js/jquery.themepunch.enablelog 
//= require plugins/isotope/isotope.pkgd 
//= require magnific-popup 
//= require plugins/SmoothScroll 
//= require plugins/modernizr 
//= require plugins/jquery.validate 
//= require plugins/jquery.parallax-1.1.3 
//= require plugins/jquery.min 
//= require plugins/jquery.knob.min 
//= require plugins/jquery.countTo 
//= require plugins/jquery.browser 
//= require owl.carousel 
//= require js/custom 
//= require js/coming.soon.config 
//= require js/google.map.config 
//= require bootstrap/js/bootstrap.min 
//= require bootstrap/js/npm 
//= require plugins/bootstrap-notify/bootstrap-notify.min 
//= require_tree ../../../vendor/assets/template/bootstrap/js 
//= require_tree ../../../vendor/assets/template/js 
//= require_tree ../../../vendor/assets/template/plugins/bootstrap-notify 
//= require_tree ../../../vendor/assets/template/plugins/charts 
//= require_tree ../../../vendor/assets/template/plugins/jasny-bootstrap/js 
//= require_tree ../../../vendor/assets/template/plugins/jquery.countdown 
//= require_tree ../../../vendor/assets/template/plugins/morphext 
//= require_tree ../../../vendor/assets/template/plugins/vide 
//= require_tree ../../../vendor/assets/template/plugins 

而且,这里是我的application.css.scss文件

@import "bootstrap"; 
@import "css/style"; 
@import "plugins/rs-plugin/css/settings-ie8"; 
@import "css/animate"; 
@import "plugins/rs-plugin/css/settings"; 
@import "css/animations"; 
@import "font-awesome"; 
@import "fontello"; 
@import "plugins/morphext/morphext"; 


/* 
* 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 vendor/assets/stylesheets of plugins, if any, 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 top of the 
* compiled file, but it's generally better to create a new file per style scope. 
* 
*= require magnific-popup 
*= require owl.carousel 
*= require owl.theme 
*= require owl.transitions 
*= require_directory ./plugins/hover 
*= require animate 
*= require jquery.countdown 
*= require 'bootstrap/css/bootstrap.css' 
*= require '/fonts/font-awesome/font-awesome.scss' 
*= require_directory ./fonts/fontello/css 
*= require_directory ./plugins/jasny-bootstrap/css 
*= require_directory ./plugins/morphext 
*= require_directory ./css/skins 
*= require_directory ./css 
*= require hover 
*/ 

页是假设这个样子http://htmlcoder.me/preview/the_project/v.1.1/template/features-sliders-video-background.html#

但滚动视频不会工作或在框中淡入。不知道该先做什么。

这里是控制台显示

处理的渲染WelcomeController#指数HTML 欢迎/ __ manager_slideshow.html.erb(0.1毫秒)内呈现的布局/应用 欢迎/ index.html.erb( 14.5ms)在4392ms(查看已完成 200 OK:4391.3ms)

开始使用,即可为10.0.2.2 “/assets/jquery.js?body=1” 在二零一五年十二月十日 五点44分二十秒+ 0000

St arted GET“/assets/jquery_ujs.?body=1”for 10.0.2.2 at 2015-12-10 05:44:20 +0000

Started GET“/assets/application.css?body=1”为10.0.2.2,在 2015年12月10日5时44分20秒+0000

开始使用,即可为10.0.2.2 “/assets/jquery.purr.js?body=1” 在2015年12月10日 05 :44:21 0000

发起者GET为10.0.2.2 “/assets/best_in_place.js?body=1” 在2015年12月10日 5点44分21秒0000

发起者GET“/资产/ jquery.autosize.js?体= 1" 10.0.2.2在 2015年12月10日5点44分21秒0000

发起者GET “为10.0.2.2 /assets/bootstrap/affix.js?body=1” 在 2015 - 12-10 5时44分22秒+0000

开始使用,即可为10.0.2.2 “/assets/bootstrap/alert.js?body=1” 在 2015年12月10日5时44分22秒+0000

开始使用,即可为10.0.2.2 “/assets/bootstrap/button.js?body=1” 在 2015年12月10日5点44分22秒+0000

入门使用“/资产/引导/崩溃。对于10.0.2.2,js?body = 1“在 2015年12月10日5时44分22秒+0000

开始使用,即可为10.0.2.2“/assets/bootstrap/carousel.js?body=1”在 2015年12月10日5时44分22秒+0000

对于10.0.2,开始GET“/assets/animate.css”。2 at 2015-12-10 05:44:23 +0000

开始获取10.0.2.2的“/assets/bootstrap/dropdown.js?body=1”在 2015-12-10 05:44: 23 +0000

开始使用,即可为10.0.2.2 “/assets/bootstrap/tab.js?body=1” 在 2015年12月10日5点44分23秒+0000

入门使用“/资产/bootstrap/transition.js?body=1“for 10.0.2.2 at 2015-12-10 05:44:23 +0000

Started GET”/assets/bootstrap/scrollspy.js?body=1“for 10.0.2.2在 2015年12月10日5点44分23秒+0000

开始使用,即可为10.0.2.2 “/assets/bootstrap/modal.js?body=1” 在 2015年12月10日5点44分23秒+ 0000

开始使用,即可为10.0.2.2 “/assets/bootstrap/tooltip.js?body=1” 在 2015年12月10日5时44分24秒+0000

入门使用“/资产/引导/popover.js?body=1“for 10.0.2.2 at 2015-12-10 05:44:24 +0000

10.0.2.2开始GET”/assets/bootstrap.js?body=1“at 2015-12-10 5时44分24秒+0000

开始使用,即可为10.0.2.2 “/assets/turbolinks.js?body=1” 在二○一五年十二月一十日 5时44分24秒+0000

开始GET “/assets/revolution-slider/jquery.themepunch.enablelog.js?body=1” 为 10.0.2.2在2015年12月10日5时44分25秒+0000

入门掌握 “/资产/ revolution-slider/jquery.themepunch.revolution.js?body = 1“for 10.0.2.2于2015-12-10 05:44:25 +0000

Sta在二○一五年十二月十日5时44分25秒+0000

入门GET“rted GET ”/assets/revolution-slider/jquery.themepunch.revolution.min.js?body=1“ 为10.0.2.2 /assets/revolution-slider/index.js?body=1“for 10.0.2.2 at 2015-12-10 05:44:25 +0000

Started GET”/assets/isotope/isotope.pkgd.js ?body = 1“for 10.0.2.2 at 2015-12-10 05:44:26 +0000

2015.2.0开始GET”/assets/magnific-popup.js?body=1“在 2015年-12-10 05:44:26 +0000

开始GET “/assets/SmoothScroll.js?body=1” 为10.0.2.2,在 2015年12月10日5时44分26秒+0000

开始GET“/assets/modernizr.js?body= 1“for 10.0.2.2 at 2015-12-10 05:44:27 +0000

已启动GET”/assets/jquery.validate.js?body=1“for 10.0.2.2 at 2015-12- 10 05:44:27 +0000

10.0.2开始GET“/assets/jquery.parallax-1.1.3.js?body=1”。2 at 2015-12-10 05:44:27 +0000

10.0.2.2在2015-12-10发起GET“/assets/jquery.min.js?body=1” 05:44: 28 +0000

开始使用,即可为10.0.2.2 “/assets/jquery.knob.min.js?body=1” 在 二○一五年十二月一十日5点44分28秒+0000

入门GET“ /assets/jquery.countTo.js?body=1“for 10.0.2.2 at 2015-12-10 05:44:28 +0000

Started GET”/assets/jquery.browser.js?body=1 “对于10.0.2.2在 2015-12-10 05:44:28 +0000

已启动GET“/assets/owl.carousel.js?body=1”for 10.0.2.2 at 2015-12-10 05:44:29 + 0000

开始使用,即可为10.0.2.2 “/assets/custom.js?body=1” 在2015年12月10日 5时44分29秒+0000

开始GET“/assets/coming.soon .config.js?body = 1“for 10.0.2.2 at 2015-12-10 05:44:29 +0000

已启动GET”/assets/google.map.config.js?body=1“for 10.0.2.2 at 2015-12-10 05:44:29 +0000

开始使用,即可为10.0.2.2 “/assets/js/bootstrap.min.js?body=1” 在 2015年12月10日五点44分29秒+0000

入门使用“/资产/ js/npm.js?body = 1“for 10.0.2.2 at 2015-12-10 05:44:30 +0000

Started GET”/assets/bootstrap-notify/bootstrap-notify.min.js?体= 1" 为10.0.2.2在2015年12月10日5时44分30秒0000

发起者GET “/assets/js/bootstrap.js?body=1” 为10.0.2.2在 2015 - 12-10 05:44:30 +0000

开始使用,即可为10.0.2.2 “/assets/template.js?body=1” 在2015年12月10日 五点44分30秒+0000

入门使用“/资产/引导,通知/ bootstrap-notify.js?body = 1“for 10.0.2.2 at 2015-12-10 05:44:31 +0000

开始GET”/assets/charts/Chart.js?body=1“为10.0 .2.2 at 2015-12-10 05:44:31 +0000

已启动GET“/assets/charts/Chart.min.js?body=1”for 10.0.2.2 at 2015-12-10 05 :44:31 +0000

入门GET “/assets/isotope/isotope.pkgd.min.js?body=1” 为10.0.2.2 在二零一五年十二月十日五点44分31秒+0000

入门使用“/ assets/jasny-bootstrap/js/jasny-bootstrap.js?body = 1“为 10.0.2.2于2015-12-10 05:44:31 +0000

开始GET”/ assets/jasny-bootstrap/js/jasny-bootstrap.min.js?body = 1“ for 10.0.2.2 at 2015-12-10 05:44:32 +0000

Started GET”/assets/jquery.countdown/jquery.countdown。 js?body = 1“为 10.0.2。2 at 2015-12-10 05:44:32 +0000

已启动GET“/assets/jquery.countdown/jquery.countdown.min.js?body=1” for 10.0.2.2 at 2015-12- 10 05:44:33 +0000

开始GET“/assets/jquery.countdown/jquery.plugin.js?body=1”为 10.0.2.2于2015-12-10 05:44:33 +0000

入门GET “/assets/jquery.countdown/jquery.plugin.min.js?body=1” 为 10.0.2.2在二零一五年十二月一十日5时44分33秒+0000

开始GET “/assets/magnific-popup/jquery.magnific-popup.j S'=体1" 10.0.2.2 在2015年12月10日5时44分33秒0000

发起者GET “/assets/magnific-popup/jquery.magnific-popup.min.js?body = 1" 10.0.2.2在二○一五年十二月一十日5时44分33秒0000

发起者GET “/assets/morphext/morphext.js?body=1” 为10.0.2.2在 2015-12 -10 05:44:34 +0000

已启动GET“/assets/morphext/morphext.min.js?body=1”for 10.0.2.2 at 2015-12-10 05:44:34 +0000

开始GET“/assets/owl-carousel/owl.carousel.js?body=1”为10.0.2.2 于2015-12-10 05:44:34 +0000

开始GET“/ assets/owl -carousel/owl.carousel.min.js?body = 1“for 10.0.2.2 at 2015-12-10 05:44:34 +0000

Started GET”/assets/pace/pace.min.js ?体= 1" 10.0.2.2在 2015年12月10日5时44分34秒0000

发起者GET “/assets/rs-plugin/js/jquery.themepunch.enablelog.js?body= 1“为 10.0.2.2于2015-12-10 05:44:34 +0000

在2015年12月10日5时44分35秒+0000

入门掌握 “/assets/rs-plugin/js/jquery.themepunch.revolution.js?body=1” 为 10.0.2.2启动GET “/assets/rs-plugin/js/jquery.themepunch.revolution.min.js?body=1” 为 10.0.2.2在二零一五年十二月十日5时44分35秒+0000

开始GET “/assets/vide/jquery.vide.js?body=1”for 10.0.2.2 at 2015-12-10 05:44:35 +0000

Started GET“/assets/vide/jquery.vide。 min.js?body = 1“为10.0.2.2,在 2015-12-10 05:44:35 +0000

开始GET“/assets/waypoints/jquery.waypoints.js?body=1”为 10.0.2.2于2015-12-10 05:44: 35 +0000

入门GET “/assets/waypoints/jquery.waypoints.min.js?body=1” 为 10.0.2.2在2015年12月10日5时44分36秒+0000

入门GET“/assets/application.js?body=1”for 10.0.2.2 at 2015-12-10 05:44:36 +0000

Started GET“/assets/rails.validations.js?body=1 “为10.0.2。2 at 2015-12-10 05:44:36 +0000

已启动GET“/assets/jquery_ujs.?body=1”for 10.0.2.2于2015-12-10 05:44:37 + 0000

开始使用,即可为10.0.2.2 “/assets/jquery.purr.js?body=1” 在2015年12月10日 5点44分37秒+0000

入门使用“/资产/ jQuery的.autosize.js?体= 1" 10.0.2.2在 二○一五年十二月一十日5点44分37秒0000

发起者GET “在/assets/best_in_place.js?body=1” 为10.0.2.2 2015-12-10 05:44:37 +0000

10.0.2.2开始GET“/assets/bootstrap/affix.js?body=1”在 2015-12-10 05:44:37 + 0000

开始使用,即可为10.0.2.2 “/assets/bootstrap/alert.js?body=1” 在 二○一五年十二月一十日5时44分37秒+0000

入门使用“/资产/引导/button.js?body=1“for 10.0.2.2 at 2015-12-10 05:44:38 +0000

已启动GET”/assets/bootstrap/carousel.js?body=1“为10.0。 2.2 at 2015-12-10 05:44:3 8 +0000

开始使用,即可为10.0.2.2 “/assets/bootstrap/collapse.js?body=1” 在 2015年12月10日5时44分38秒+0000

入门使用“/资产/bootstrap/dropdown.js?body=1“for 10.0.2.2 at 2015-12-10 05:44:38 +0000

Started GET”/assets/bootstrap/tab.js?body=1“for 10.0.2.2 at 2015-12-10 05:44:38 +0000

对于10.0.2.2开始GET“/assets/bootstrap/transition.js?body=1”在 2015-12-10 05: 44:38 +0000

开始使用,即可为10.0.2.2 “/assets/bootstrap/scrollspy.js?body=1” 在 2015年12月10日5点44分39秒+0000

入门使用“/资产/引导/ modal.js?body = 1“for 10.0.2.2 at 2015-12-10 05:44:39 +0000

对于10.0.2.2开始GET”/assets/bootstrap/tooltip.js?body=1“ at 2015-12-10 05:44:39 +0000

已启动GET“/assets/bootstrap/popover.js?body=1”for 10.0.2.2 at 2015-12-10 05:44:39 +0000

开始使用,即可为10.0.2.2 “/assets/bootstrap.js?body=1” 在2015年12月10日 5点44分39秒+0000

入门GET“/assets/turbolinks.js?体= 1" 10.0.2.2在2015年12月10日 5点44分40秒0000

发起者GET “/assets/revolution-slider/jquery.themepunch.enablelog.js?body=1” 为 10.0.2.2 at 2015-12-10 05:44:40 +0000

Started GET “/assets/revolution-slider/jquery.themepunch.revolution.js?体= 1" 10.0.2.2在2015年12月10日5点44分40秒0000

发起者GET “/assets/revolution-slider/jquery.themepunch.revolution.min.js?body=1 “ 为10.0.2.2,在2015年12月10日五点44分40秒+0000

入门GET ”/assets/revolution-slider/index.js?body=1“ 为10.0.2.2 在2015-12 -10 5时44分41秒+0000

开始使用,即可为10.0.2.2 “/assets/isotope/isotope.pkgd.js?body=1” 在 2015年12月10日5时44分41秒+0000

已启动GET“/assets/magnific-popup.js?body=1”for 10.0.2.2 at 2015-12-10 05:44:41 +0000

Started GET“/assets/SmoothScroll.js?body = 1“for 10.0.2.2 at 2015-12-10 05:44:41 +0000

开始GET”/assets/modernizr.js?body=1“for 10.0.2.2于2015-12-10 5时44分41秒+0000

开始使用,即可为10.0.2.2 “/assets/jquery.validate.js?body=1” 在 2015年12月10日5点44分42秒+0000

入门GET“/ asse ts/jquery.parallax-1.1.3.js?body = 1“for 10.0.2.2 at 2015-12-10 05:44:42 +0000

Started GET”/assets/jquery.min.js?身体= 1“为10.0.2.2在2015-12-10 05:44:42 +0000

开始GET”/assets/jquery.knob.min.js?body=1“为10.0.2.2在 2015-12-10 05:44:42 +0000

已启动GET“/assets/jquery.countTo.js?body=1”for 10.0.2.2 at 2015-12-10 05:44:42 +0000

Started GET“/assets/jquery.browser.js?bod Y = 1" 10.0.2.2在 2015年12月10日5时44分43秒0000

发起者GET “/assets/owl.carousel.js?body=1” 为10.0.2.2在 2015 - 12-10 5时44分43秒+0000

开始使用,即可为10.0.2.2 “/assets/custom.js?body=1” 在二○一五年十二月十日 5时44分43秒+0000

开始使用,即可为10.0.2.2 “/assets/coming.soon.config.js?body=1” 在 2015年12月10日5点44分43秒+0000

开始GET“/assets/google.map。 config.js?body = 1“为10.0.2.2在 2015-12-10 05:44:43 +0000

已启动GET“/assets/js/bootstrap.min.js?body=1”for 10.0.2.2 at 2015-12-10 05:44: 43 0000

发起者GET为10.0.2.2 “/assets/js/npm.js?body=1” 在2015年12月10日 5时44分44秒0000

发起者GET“/资产/bootstrap-notify/bootstrap-notify.min.js?body=1" 为10.0.2.2,在2015年12月10日5时44分44秒+0000

入门GET“/assets/js/bootstrap.js对于10.0.2,“body = 1”。2在2015年12月10日 5点44分44秒0000

发起者GET为10.0.2.2 “/assets/template.js?body=1” 在2015年12月10日 5点44分44秒+ 0000

入门GET “/assets/bootstrap-notify/bootstrap-notify.js?body=1” 为 10.0.2.2在2015年12月10日5时44分44秒+0000

入门GET“ /assets/charts/Chart.js?body=1“for 10.0.2.2 at 2015-12-10 05:44:45 +0000

Started GET”/assets/charts/Chart.min.js?body = 1“10.0.2.2在 2015-12-10 05:44:45 +0000

开始GET“/assets/isotope/isotope.pkgd.min.js?body=1”为10.0.2.2 于2015-12-10 05: 44:45 +0000

入门GET “/assets/jasny-bootstrap/js/jasny-bootstrap.js?body=1” 为 10.0.2.2在2015年12月10日5点44分45秒+0000

入门GET “/assets/jasny-bootstrap/js/jasny-bootstrap.min.js?body=1” 为10.0.2.2,在2015年12月10日5时44分45秒+0000

入门GET“/assets/jquery.countdown/jquery.co 10.0.2.2 at 2015-12-10 05:44:46 +0000

Started GET“/assets/jquery.countdown/jquery.countdown.min.js?body=” 1" 为10.0.2.2,在2015年12月10日5时44分46秒+0000

入门GET “/assets/jquery.countdown/jquery.plugin.js?body=1” 为 10.0.2.2在2015-12-10 05:44:46 +0000

开始GET“/assets/jquery.countdown/jquery.plugin.min.js?body=1”为 10.0.2.2于2015-12-10 05 :44:46 +0000

开始GET “/assets/magnific-popup/jquery.magnific-popup.js?body=1” 为10.0.2.2在2015年12月10日5点44分46秒0000

发起者GET “/ assets/magnific-popup/jquery.magnific-popup.min.js?body = 1“for 10.0.2.2 at 2015-12-10 05:44:46 +0000

Started GET”/ assets/morphext/morphext.js?体= 1" 10.0.2.2在 2015年12月10日5时44分47秒0000

发起者GET “/assets/morphext/morphext.min.js?body=1” 10.0 .2.2 at 2015-12-10 05:44:47 +0000

入门GET “/assets/owl-carousel/owl.carousel.js?body=1” 为10.0.2.2 在2015年12月10日5时44分47秒+0000

入门使用“/资产/owl-carousel/owl.carousel.min.js?body=1“for 10.0.2.2 at 2015-12-10 05:44:47 +0000

Started GET”/assets/pace/pace.min的.js?体= 1" 10.0.2.2在 二○一五年十二月一十日5点44分47秒0000

发起者GET “/assets/rs-plugin/js/jquery.themepunch.enablelog.js?身体= 1“为 10.0.2。2,在2015年12月10日五时44分47秒+0000

入门掌握 “/assets/rs-plugin/js/jquery.themepunch.revolution.js?body=1” 为 10.0.2.2在2015年-12-10 5时44分48秒+0000

入门掌握 “/assets/rs-plugin/js/jquery.themepunch.revolution.min.js?body=1” 为 10.0.2.2在2015 - 12-10 05:44:48 +0000

对于10.0.2.2开始GET“/assets/vide/jquery.vide.js?body=1”在 2015-12-10 05:44:48 +0000

入门掌握了10.0.2.2 “/assets/vide/jquery.vide.min.js?body=1” 在 2015年12月10日5时44分48秒+0000

入门使用“/资产/航点/jquery.waypoints.js?body=1“for 10.0.2.2 at 2015-12-10 05:44:48 +0000

Started GET”/assets/waypoints/jquery.waypoints.min.js?body = 1“for 10.0.2.2 at 2015-12-10 05:44:49 +0000

已启动GET”/assets/application.js?body=1“for 10.0.2.2于2015-12-10 05:44:49 +0000

开始使用,即可为10.0.2.2 “/assets/rails.validations.js?body=1” 在 2015年12月10日5点44分49秒+0000

入门GET“/assets/fontawesome-webfont.woff2 ?v = 4.5.0" 为10.0.2.2 在2015年12月10日5时44分49秒+0000

所以从我所看到的一切都装载有没有错误。我也注意到,有一类是有一些JavaScript运行如

<div class="pv-30 ph-20 feature-box bordered shadow text-center object-non-visible" data-animation-effect="fadeInLeftSmall" data-effect-delay="100"> 

任何物体不会因为“对象不可见”它永远不会变得可见装载这使我进一步认为,一些JS没有加载或好好工作。

回答

0

该问题可能是由于turbolinks引起的,默认情况下,所有Rails 4应用程序都包含该问题。 Turbolinks非常适合加载时间,但由于它覆盖了正常的页面加载过程,所以不能依赖jQuery.ready()$(document).on('ready', ...来执行代码(link)。

如果你可以修改使用page:change事件,而不是ready应该工作,或JavaScript的,如果你宁愿只是删除turbolinks你可以把它从一个特定的链接即可加入data-no-turbolinks到锚元素,或完全删除它like so

你也可以试试看看jquery.turbolinks gem,它旨在解决这个问题。

+0

在我改变javascript之前,我按照你的建议去掉了turbolinks,没有改变,所以我不认为是这样。在turbolinks后仍然没有显示滑块被删除 – SupremeA

+0

嗯,在这种情况下,我不完全确定。你是否已经尝试在代码块中插入一个'debugger'语句来判断它是否被执行? –

+0

它的一个滑块,所以我把一个调试器只是在代码中,没有任何显示与以前相同,这再次导致我的JavaScript问题。 – SupremeA