Reputation: 1
I want to eliminate the topMenu when the width of the window is wider than 479px.
This is the code, and I used .hide and .css('display','none') and, even .slideToggle(false), but it doesn't work. The default setting in CSS is display:none.
The slideToggle Menu appears when windows are smaller than 479px with a click event, and then, when windows are wider than 479px I need to stop that function, because I have another menu for wider windows, that appears with the same click event.
I can´t make disapear or eliminate that function in wider windows.
$(window).on('resize', function(event){
var windowSize = $(window).width();
if(windowSize > 479){
$('#topMenu2').hide();
}
});
Any ideas?
Upvotes: 0
Views: 1129
Reputation: 106
Use CSS instead:
@media screen and (max-width: 479px)
{
#topMenu2
{
display: block;
}
}
Upvotes: 1
Reputation: 27082
What about CSS solution?
@media screen and (min-width: 479px) {
#topMenu2 {display: none}
}
Upvotes: 1