Your answer is nearly correct. All you need to do is add an else.
$(window).resize(function() {
if($(window).width() > 768) {
jQuery('#header').css( "background-size", "cover" );
} else {
jQuery('#header').css( "background-size", "whatever" );
}
});
I'm concerned about you writing all over the place jQuery
so what you can do is also:
jQuery(function( $ ) { // DOM ready and secured jQuery's $ alias
// Use freely $ alias
var $header = $('#header'); // Cache your selectors
$(window).resize(function() {
$header.css({backgroundSize:$(this).width()>768?"cover":"whatever"});
});
// Other $ code here
});