This should get you where you want to be, but a few things to keep in mind:
Element id's need to be unique. Instead use a class.
In your code example you don't have closing tags for your div's.
Here are two ways of getting what you want.
jquery:
add a rule to your stylesheet:
.advert {
display: none;
}
$(document).ready(function() {
if($(window).width() >= 1024) {
$('.advert').show();
} else {
$('.advert').hide();
}
});
css way using a media query (note: older browser don't support media queries):
within your stylesheet add
@media screen and (max-width: 1024px) {
.advert {
display: none !important;
}
}
gl
