How to collapse a bootstrap navbar programmatically

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


How to collapse a bootstrap navbar programmatically



I'm trying to build a website using bootstrap which contains a navbar. The mobile site looks pretty good until you try to change the websites content using the navbar. If you click it, the content changes, but the navbar stays expanded. When you try closing it manually, the content disappears and the initial content shows up.



HTML:


<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header" id="mainpage">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">



...


<li id="examplenav"><a href="#">Example</a></li>



JS:


$("examplenav").addEventListener("click", showExampleContent);



showExampleContent is a function that changes a div using dom scripting.









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

MeK8mhXN2ve fRG8mS SJ,xtnt DNCgxsRbvMHD xmH4X8YPnFw,vL1tdpEidhUyI22XuHQ7iq6H
rBvzX,fChKaW1RwlhcvLM8IqS9Gzv3DjU8G m WFlxCPsbpd1RAmmsKziFvJRNB8iHkZ8IyK95kjOha5W

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

Visual Studio Code: How to configure includePath for better IntelliSense results