I have implemented a collapsible navbar using Bootstrap 4 framework according to the documentation provided at this link. The navbar and its contents collapse on small screens, including smartphones, by adding the class .collapse.navbar-collapse.
You can see a working demo here:
One interesting challenge I encountered was trying to create a collapsible navbar using only Pure/Vanilla JavaScript (no jQuery). Here is my attempt which unfortunately didn't work as expected:
<!doctype html>
<html lang="en>
<!-- Rest of the code excluded for brevity -->