Needed to add the window resize function
$(document).ready(function() {
$(window).resize(function(){
if ($(window).width() <= 1024){
$(".navbar").hide();
} else {
$(".navbar").show();
}
});
$(".toggle").click(function() {
$(".navbar").slideToggle("slow", function() {
// Animation complete.
});
});