$(function(){
if($(window).width()>1100){
$("#logo").hover(function(){
$(this).animate({paddingTop:"0px",paddingBottom:"20px"},200);
},function(){
$(this).animate({paddingTop:"20px",paddingBottom:"0"},200);
});
}
$(window).resize(function(){
if($(window).width()>1100){
$("#logo").hover(function(){
$(this).animate({paddingTop:"0px",paddingBottom:"20px"},200);
},function(){
$(this).animate({paddingTop:"20px",paddingBottom:"0"},200);
});
}
});
});
Right now, this animation is only executed when the window width is greater than 1100 px but it requires a refresh of the browser if the browser is resized on the fly. How can this be fixed so that a browser refresh is not needed?