Uncaught ReferenceError: jQuery is not defined transition.js:59 at Object../node_modules/bootstrap/js/transition.js (transition.js:59) at __webpack_require__ (bootstrap:19) at Object../node_modules/bootstrap/dist/js/npm.js (npm.js:2) at __webpack_require__ (bootstrap:19) at Module../app/javascript/packs/application.js (application.js:1) at __webpack_require__ (bootstrap:19) at bootstrap:83 at bootstrap:83
というエラーがデベロッパーツールを見ると出ておりjQueryが実行されません。
application.jsです。
javascript
1コード 2require("@rails/ujs").start() 3require("turbolinks").start() 4require("@rails/activestorage").start() 5require("channels") 6require_tree . 7window.$ = window.jQuery = require('jquery') 8import "bootstrap" 9 10 11window.onload = (function () { 12 setTimeout("$('.time-limit-success').fadeOut('slow')", 5000) 13}) 14 15window.onload = (function () { 16 setTimeout("$('.time-limit-danger').fadeOut('slow')", 5000) 17}) 18/*--------------------------------------------------------------------------* 19 * 20 * footerFixed.js 21 * 22 * MIT-style license. 23 * 24 * 2007 Kazuma Nishihata [to-R] 25 * http://blog.webcreativepark.net 26 * 27 *--------------------------------------------------------------------------*/ 28 29window.onload = (function(){ 30 var $ftr = $('#footer'); 31 if( window.innerHeight > $ftr.offset().top + $ftr.outerHeight() ){ 32 $ftr.attr({'style': 'position:fixed; top:' + (window.innerHeight - $ftr.outerHeight()) + 'px;' }); 33 } 34});
applicaton.htmlです。
html
1コード 2<!DOCTYPE html> 3<html lang="ja"> 4<html> 5 6<head> 7 <title>ヨーロッパサッカー掲示板</title> 8 <%= csrf_meta_tags %> 9 <%= csp_meta_tag %> 10 11 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> 12 <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 13 <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %> 14 <%= render "layouts/shim" %> 15</head> 16 17<body> 18<div class="footer_fixed"> 19 <%= render "layouts/header" %> 20 <%= render "layouts/flash" %> 21 <%= yield %> 22 <%= render "layouts/footer" %> 23 </div> 24 25</body> 26 27</html> 28
あなたの回答
tips
プレビュー