以下のコードはライブサイトで動作しますが、jsfiddleサイトで実行することはできません。それはjsfiddleに取り組んでいない理由誰も私のjsコードがjsfiddleで動作していない理由を教えてもらえますか?
が{
"message": "ReferenceError: $ is not defined",
"filename": "https://stacksnippets.net/js",
"lineno": 108,
"colno": 9
}
は、誰も私に伝えることができます: それは私には、下記のエラーが表示されますか? は私が解決策を見つけることができない、私にそれはスニペットとしてここに埋め込まだときに見ることができるようにコードが動作する 溶液を得た誰もここ:
$(document).ready(function(){
\t $(window).bind('scroll', function() {
\t var navHeight = $(window).height() - 70;
\t \t \t if ($(window).scrollTop() > navHeight) {
\t \t \t \t $('nav').addClass('fixed');
\t \t \t }
\t \t \t else {
\t \t \t \t $('nav').removeClass('fixed');
\t \t \t }
\t \t });
\t });
/*
Tutorial Name: Scroll To Top Then Fixed Navigation Effect With JQuery and CSS
https://stanhub.com/scroll-to-top-then-fixed-navigation-effect-with-jquery-and-css-free-download/
Description: Create a sticky navigation bar that remains fixed to the top after scroll
Author: Stan Kostadinov
Author URI: https://stanhub.com
Version: 1.0.0 - 11.01.2014
*/
* {margin: 0; padding: 0;}
a {text-decoration: none;}
/* This class is added on scroll */
.fixed {
\t position: fixed;
\t top: 0;
\t height: 70px;
\t z-index: 1;
}
body {
\t color: #fff;
\t font-family: 'open-sans-bold', AvenirNext-Medium, sans-serif;
\t font-size: 18px;
\t text-align: center;
}
/* Navigation Settings */
nav {
\t position: absolute;
\t bottom: 0;
\t width: 100%;
\t height: 70px;
\t background: #fff;
}
nav li {
\t display: inline-block;
\t padding: 24px 10px;
}
nav li a {
\t color: #757575;
\t text-transform: uppercase;
}
section {
\t height: 100vh;
}
/* Screens Settings */
#screen1 {
\t background: #43b29d;
}
#screen1 p {
\t padding-top: 200px;
}
#screen2 {
\t background: #efc94d;
}
#screen3 {
\t background: #e1793d;
}
@media only screen and (max-width: 520px) {
\t nav li {
\t \t padding: 24px 4px;
\t }
\t nav li a {
\t \t font-size: 14px;
\t }
}
<section id="screen1">
\t <p>Scroll down</p>
\t <nav>
\t \t <ul>
<li><a href="#">Home</a></li>
\t \t \t <li><a href="#">About</a></li>
\t \t \t <li><a href="#">Services</a></li>
\t \t \t <li><a href="#">Team</a></li>
\t \t \t <li><a href="#">Contact</a></li>
\t \t </ul>
\t </nav>
</section>
<section id="screen2"></section>
<section id="screen3"></section>
[JSfiddleにjQueryを追加する方法](https://stackoverflow.com/questions/36620565/how-to-add-jquery-to-jsfiddle) – agrm