Doing different size of sidebar at full screen and small screen but it not work until i reload the page at small screen or full screen

```
<script>
if ($(window).width() < 960) {
  function openNav() {
    document.getElementById("mySidebar").style.width = "70%";
  }

  function closeNav() {
    document.getElementById("mySidebar").style.width = "0%";
    document.getElementById("main").style.paddingLeft = "0";
    document.getElementById("table-name").style.marginRight = "0";
    document.getElementById("table-name").style.marginLeft = "0";
  }
} else if ($(window).width() > 960) {
  function openNav() {
    document.getElementById("mySidebar").style.width = "14%";
    document.getElementById("main").style.paddingLeft = "13%";
    document.getElementById("table-name").style.marginRight = "28px";
    document.getElementById("table-name").style.marginLeft = "26px";
  }

  function closeNav() {
    document.getElementById("mySidebar").style.width = "0";
    document.getElementById("main").style.paddingLeft = "0";
    document.getElementById("table-name").style.marginRight = "0";
    document.getElementById("table-name").style.marginLeft = "0";
  }
}
</script>

```