jquery if statement based on screen size
Just test for screen.width > 1024
.
https://developer.mozilla.org/en/DOM/window.screen.width
$(document).ready(function() {
// This will fire when document is ready:
$(window).resize(function() {
// This will fire each time the window is resized:
if($(window).width() >= 1024) {
// if larger or equal
$('.element').show();
} else {
// if smaller
$('.element').hide();
}
}).resize(); // This will simulate a resize to trigger the initial run.
});
Edit:
Or maybe this is what you're after:
$(document).ready(function() {
if($(window).width() >= 1024) {
$('a.expand').click();
}
});
This will toggle the element when document is ready if the width is correct.