Reputation: 1
I can't seem to get my if statement working. I know that everything inside the if statement works, so would appreciate some help.
$(document).ready(function () {
if(screen.width > 350) {
$('#search').hide();
$('.trigger').click(function () {
$('#search').slideToggle("500");
});
}
});
Upvotes: 0
Views: 1009
Reputation: 308
This returns width of browser viewport:
$(window).width();
This returns width of HTML document:
$(document).width();
Upvotes: 1
Reputation: 1507
try using:
if ($(window).width() > 350) {
or
if ($(document).width() > 350) {
i hope it helps.
Upvotes: 1