Bootstrap-Notification does not open when clicking the bell

Asked

Viewed 791 times

0

I use "Bootstrap Notification" here.

I just want to show a dropdown type by clicking on the notification. An example to follow:inserir a descrição da imagem aqui

But the following code happens nothing. It only shows bell.

<div class="row nav1">
  <nav class="navbar navbar-inverse" id="top-menu" role="navigation">
    <div class="container-fluid">
      <!-- Brand and toggle get grouped for better mobile display -->
      <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-target="#navbarCollapse" data-toggle="collapse"> <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>

        </button>
      </div>
      <!-- Collapse navigation -->
      <div class="collapse navbar-collapse" id="navbarCollapse">
        <ul class="nav navbar-nav">
          <li class="active"> <a href="#">HOME</a>

          </li>
          <li> <a href="#">YOUR ACCOUNT</a>

          </li>
          <li class="dropdown dropdown-notifications">
        <a href="#notifications-panel" class="dropdown-toggle">
            <i data-count="2" class="glyphicon glyphicon-bell notification-icon"></i>
        </a>

        <div class="dropdown-container">

            <div class="dropdown-toolbar">
                <div class="dropdown-toolbar-actions">
                    <a href="#">Mark all as read</a>
                </div>
                <h3 class="dropdown-toolbar-title">Notifications (2)</h3>
            </div><!-- /dropdown-toolbar -->

            <ul class="dropdown-menu">
                <li><a href="#">Dashboard</a></li>
                <li><a href="#">Projects</a></li>
                <li><a href="#">People</a></li>
            </ul>

            <div class="dropdown-footer text-center">
                <a href="#">View All</a>
            </div><!-- /dropdown-footer -->

        </div><!-- /dropdown-container -->
    </li><!-- /dropdown -->
        </ul>
      </div>
    </div>
    <!-- End container-fluid -->
  </nav>
  <!-- End navbar-inverse -->
</div>

Or if you prefer jsfiddle here.

1 answer

2


Add the class open the tag concerning the bell.

<li class="dropdown dropdown-notifications open">

Next, it would be interesting to use Javascript to add and remove this class in the click event.

  • merchant, see: http://jsfiddle.net/ofz9Lgom/40/, had forgotten the class open

  • That’s right. By the way, your Javascript can be simplified: http://jsfiddle.net/pcwLpes4/

  • Just make sure that using the element and its classes as the selector of the click event will not generate conflicts in the future. Maybe it’s a good idea to use a id.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.