I am using css media query and jQuery. Once the screen size is at 767px I want it to run a jQuery click function. But how do I stop the jQuery click function once the screen width is greater than 767px? Here is my code:
jQuery:
$(document).ready(function() {
$(".custom-filter").click(function(){
$(".fa").toggle();
$("#test").slideToggle("slow");
});
$("div.filter-group-shop-by-collecti h4").click(function(){
$("ul.nav-shop-by-collecti").slideToggle("slow");
});
$("div.filter-group-shop-by-shoe h4").click(function(){
$("ul.nav-shop-by-shoe").slideToggle("slow");
});
$("div.filter-group-price h4").click(function(){
$("ul.nav-price").slideToggle("slow");
});
$("div.filter-group-size h4").click(function(){
$("ul.nav-size").slideToggle("slow");
});
});
CSS:
@media only screen and (max-width: 767px) {
.custom-filter {
border: 1px solid #bcbcbc;
display: inline-block;
padding: 5px 20px 5px 15px;
color: black;
font-size: 17px;
border-radius: 2px;
}
div#test.filter-menu {
display: none;
}
ul.nav-shop-by-collecti {
display: none;
}
ul.nav-shop-by-shoe {
display: none;
}
ul.nav-price {
display: none;
}
ul.nav-size {
display: none;
}
.fa-chevron-down {
font-size: 10px;
font-weight: normal;
}
.fa-chevron-up {
font-size: 10px;
font-weight: normal;
display: none;
}
.sidebar-cont.cf {
position: relative;
bottom: 30px;
}
}
Once it is greater than 767px I want the click function to be disabled.