jQuery window resize show button
<p>I've made a simple jQuery function where when the window gets resized to less than 1000, a button with class <code>navbar-toggle</code> gets shown, and an unordered list with class <code>navbar-nav</code> gets hidden (this is the navigation). </p>

<p>Problem is, when the button gets shown and the navbar gets hidden, the button doesn't actually function as it should - to provide a dropdown list. Just need help to make this button actually function as it should</p>

<p>jQuery function:</p>

<pre><code>$(window).resize(function() {
    if ($(window).width() &lt; 1000) {
        $(".navbar-toggle").show();
        $(".navbar-nav").hide();
    } else {
        // do nothing
    }
});
</code></pre>

<p>HTML/ERB:</p>

<pre><code>&lt;div class="navbar navbar-inverse navbar-static-top"&gt;
    &lt;div class="container"&gt;   
        &lt;a class="navbar-brand" href="http://localhost:3000"&gt;Buy &amp;amp; Sell&lt;/a&gt;
        &lt;button class="navbar-toggle" data-toggle="collapse" data-target="#navHeaderCollapse"&gt;
            &lt;span class="icon-bar"&gt;&lt;/span&gt;
            &lt;span class="icon-bar"&gt;&lt;/span&gt;
            &lt;span class="icon-bar"&gt;&lt;/span&gt;
        &lt;/button&gt;
        &lt;div class="collapse navbar-collapse" id="navHeaderCollapse"&gt;
            &lt;ul class="nav navbar-nav"&gt;
                &lt;li&gt;&lt;%= link_to "All Items", root_path %&gt;&lt;/li&gt;
                &lt;% Category.all.each do |category| %&gt;
                    &lt;li&gt;&lt;%= link_to category.name, items_path(category: category.name) %&gt;&lt;/li&gt;
                &lt;% end %&gt;
            &lt;/ul&gt;
            &lt;% if user_signed_in? %&gt;
            &lt;ul class="nav navbar-nav navbar-right"&gt;
                &lt;li&gt;&lt;%= link_to "New Item", new_item_path %&gt;&lt;/li&gt;
                &lt;li&gt;&lt;%= link_to "Account", edit_user_registration_path %&gt;&lt;/li&gt;
                &lt;li&gt;&lt;%= link_to "Sign Out", destroy_user_session_path, method: :delete %&gt;&lt;/li&gt;
            &lt;/ul&gt;
            &lt;% else %&gt;
            &lt;ul class="nav navbar-nav navbar-right"&gt;
                &lt;li&gt;&lt;%= link_to "Sign Up", new_user_registration_path %&gt;&lt;/li&gt;
                &lt;li&gt;&lt;%= link_to "Log In", new_user_session_path   %&gt;&lt;/li&gt;
            &lt;/ul&gt;
            &lt;% end %&gt;
        &lt;/div&gt;
    &lt;/div&gt; 
&lt;/div&gt;
</code></pre>