Good day. I am in the process of building a website using slim framework 3. Everything works well except for when i am in mobile view the navigation is not working, for example if i click the about page while in mobile view it does not route to about page, but in full web view the navigation works great when i click on about it goes to the page. I am also using the twig template and materializecss. By the way this is my first time using slim.
Herewith some code from my project
//main.twig
<nav role="navigation">
<div class="nav-wrapper container">
<a id="logo-container" href="" class="brand-logo">
<img style="width: 120px;" src="static/images/cycle-way.%20logo.png"/>
</a>
<a href="#" data-activates="nav-mobile" class="button-collapse"><i class="material-icons">menu</i></a>
<ul class="right hide-on-med-and-down">
<li><a href="{{ path_for('/') }}">Home</a></li>
<li><a href="{{ path_for('/about') }}">About</a></li>
<li><a href="{{ path_for('/services') }}">Services</a></li>
<li><a href="#">Shop</a></li>
<li><a href="#">Blog</a></li>
</ul>
<ul class="side-nav" id="nav-mobile">
<li><a href="{{ path_for('/') }}">Home</a></li>
<li><a href="{{ path_for('/about') }}">About</a></li>
<li><a href="{{ path_for('/services') }}">Services</a></li>
<li><a href="#">Shop</a></li>
<li><a href="#">Blog</a></li>
</ul>
</div>
</nav>
//index.php
//index page
$app->get('/', function ($request, $response, $args) {
return $this->view->render($response, 'home.twig');
})->setName('/');
// about page
$app->get('/about', function (Request $request, Response $response) {
return $this->view->render($response, 'about.twig');
})->setName('/about');
// about page
$app->get('/services', function (Request $request, Response $response) {
return $this->view->render($response, 'services.twig');
})->setName('/services');
// Run app
$app->run();