I'm having trouble getting a dropdown menu to work on the mobile version of my website.
When I click on the dropdown menu image, it's supposed to appear, but it's not working as expected.
JSFiddle: https://jsfiddle.net/xfvjv184/
Included files:
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.3/jquery.mobile.min.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.3/jquery.mobile.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
HTML
<div class="mobile_dropdown_menu_icon">
<img class="mobilemenuicon" src="resources/mobilemenuicon.png" />
</div>
<div class="mobile_dropdown_menu">
</div>
CSS
.mobile_dropdown_menu_icon {
display:none;
}
.mobile_dropdown_menu {
display:none;
}
@media(max-device-width:500px) {
.mobile_dropdown_menu_icon {
display: block;
float:right;
}
.mobilemenuicon {
width:150px;
height:150px;
margin-top:10px;
margin-right:20px;
}
.mobile_dropdown_menu {
background-color: red;
height:400px;
width:100%;
}
}
jQuery
$(document).ready(function(){
$('.mobile_dropdown_menu_icon').on("click" function() {
$('mobile_dropdown_menu').css("display", "block");
});
});
I can't figure out why this isn't working as intended. Clicking the icon should display the mobile_dropdown_menu, but it doesn't with this code.