前提・実現したいこと
LPの模写コーディング中です。
jQueryのプラグインを使って背景画像をフェードインのスライドにしたいです。
発生している問題・エラーメッセージ
背景画像が表示されません。
エラーメッセージ
該当のソースコード
<!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"> <title>PAS-POL</title> <link rel="stylesheet" href="style.css"> </head> <body> <header> <div class="bg-slider"> <div class="header-title"> <a href="file:///C:/Users/kuras/OneDrive/%E3%83%87%E3%82%B9%E3%82%AF%E3%83%88%E3%83%83%E3%83%97/%E6%A8%A1%E5%86%99/index.html"><img src="https://pas-pol.jp/wp-content/themes/pas-pol/dist/img/siteLogo-pc@2x.png" alt=""></a> </div> <div class="header-list"> <ul> <li><a href="#">TOP</a></li> <li><a href="#">PRODUCT</a></li> <li><a href="#">ABOUT</a></li> <li><a href="#">NEWS</a></li> <li><a href="#">CONTACT</a></li> </ul> </div> </div> </header> <main></body> </html> ```style.css body { margin: 0 auto; } header { height: 120px; } .header-title { padding: 52px 0 0 97px; float: left; transition: all 0.5s; z-index: 50; } .header-title:hover { opacity: 0.5; } .header-title img { width: 272px; height: 67px; } .header-list { padding-top: 60px; z-index: 50; } .header-list a { text-decoration: none; transition: all 0.1s; color: white; } .header-list ul { list-style: none; float: right; padding-right: 70px; } .header-list li { float: left; padding-right: 35px; } .header-list a:hover { border-bottom: 3px solid white; padding-bottom: 2px; } .bg-slider { width: 100vw; height: 100vh; background-position:center center; background-size: cover; display: flex; align-items: center; justify-content: center; } ```</main> <script src="js/jquery.min.js"></script> <script src="js/jquery.bgswitcher.js"></script> <script> jQuery(function($) { $('.bg-slider').bgSwitcher({ images: ['https://pas-pol.jp/wp-content/uploads/2014/11/main_visual_13-0x0.jpg','https://pas-pol.jp/wp-content/uploads/2014/11/main_visual_2-0x0.jpg','https://pas-pol.jp/wp-content/uploads/2014/11/main_visual_6-0x0.jpg','https://pas-pol.jp/wp-content/uploads/2014/11/main_visual_7-0x0.jpg','https://pas-pol.jp/wp-content/uploads/2014/11/main_visual_111-0x0.jpg'], interval: 5000, loop: true, shuffle: true, effect: "fade", // fade,blind,clip,slide,drop,hide duration: 500, easing: "swing" // linear,swing }); }); </script>
試したこと
ここに問題に対して試したことを記載してください。
補足情報(FW/ツールのバージョンなど)
jQueryファイルとjquery.bgswitcher.jsのファイルはダウンロードしました。
初質問なので不足部分があると思います。
あなたの回答
tips
プレビュー