the dropdown menu is not showing please help me..
下拉菜单没有显示请帮帮我..
Here is my jsfiddle https://jsfiddle.net/vryfgmh5/
这是我的jsfiddle https://jsfiddle.net/vryfgmh5/
and here is my sample code
这是我的示例代码
HTML
<header class="header">
<a href="#" class="header__icon" id="header__icon"></a>
<a href="#" class="header__logo">Logo</a>
<nav class="menu">
<a href="#">Home</a>
<a href="#">About</a>
<a href="#">Blog</a>
<a href="#">Contact</a>
</nav>
</header>
JS
$(document).ready(function() {
(function($) {
$('#header__icon').click(function(e) {
e.preventDefault();
$('body').toggleClass('with--sidebar');
});
$('#site-cache').click(function(e) {
$('body').removeClass('with--sidebar');
});
})(jQuery);
});
1 个解决方案
#1
2
If you right-click on your browser and select "inspect" you'll see an error in the browser console "(index):160 Uncaught ReferenceError: $ is not defined"
如果右键单击浏览器并选择“检查”,您将在浏览器控制台中看到错误“(索引):160未捕获的ReferenceError:$未定义”
In the fiddle page, you don't have jquery included. I'm assuming this might be the problem with your local code too.
在小提琴页面中,您没有包含jquery。我假设这可能是您的本地代码的问题。
#1
2
If you right-click on your browser and select "inspect" you'll see an error in the browser console "(index):160 Uncaught ReferenceError: $ is not defined"
如果右键单击浏览器并选择“检查”,您将在浏览器控制台中看到错误“(索引):160未捕获的ReferenceError:$未定义”
In the fiddle page, you don't have jquery included. I'm assuming this might be the problem with your local code too.
在小提琴页面中,您没有包含jquery。我假设这可能是您的本地代码的问题。