nav bar dissapears(in full size window) after using the menu button in mobile size

nav bar dissapears(in full size window) after using the menu button in mobile size

I've been following a tutorial about nav bars and everything is good except when i make the window small and try the menu button and re-scale the window to normal size everything disappears, im a noob so if my question is not good please understand.

I've been following a tutorial about nav bars and everything is good except when i make the window small and try the menu button and re-scale the window to normal size everything disappears, im a noob so if my question is not good please understand.

i've trying adding an if statement(js) but i doesnt solve the problem.

https://codepen.io/diegopiscoya/pen/yZJWBy

    <script type="text/javascript">
$(document).ready(function(){
        $(".menu").click(function(){
            $("nav").slideToggle(500);
        })
    })
</script>

i expected the script to work only when the window size is <900 but it works always so when the menu button hides the nav bar it does it in full size as well

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Building a minesweeper game using Javascript, HTML and CSS

In this article, you'll learn how to build minesweeper using JavaScript, HTML and CSS. I also used jQuery, a JavaScript library that is helpful for interacting with html. Whenever you see a function call with a leading dollar sign, that is jQuery at work

Material Login & Signup Form with CSS, HTML and JavaScript

How we can create a login and signup form with the material design using HTML CSS JavaScript? Solution: See this CSS Material Login & Signup Form With jQuery, Material Design Form.

Bar Graphs with Animation using JavaScript, HTML, & CSS

How we can create Bar Graphs With Animation using JavaScript, HTML, & CSS? Solution: JavaScript Animated Bar Graph. In Other Words, Bar Chart With Animation Effects.