2016-03-26 7 views
0

Also hier ist, was ich tun möchte, hinzufügen Login/Anmeldung (wenn ausgeloggt) Profil hinzufügen/abmelden (wenn angemeldet) in toggle Navigationsmenü, wenn mein Web in Mobile ist Version (xs). Ich will nichts, wenn meine Web in Desktop-Version ist (sm, md, lg, xl)So fügen Sie ein Menü hinzu, um die Navigationsleiste im Bootstrap umzuschalten

Ich habe Code wie dieses Recht jetzt

<nav class="navbar navbar-default navbar-static-top" 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 collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> 
     <span class="sr-only">Toggle navigation</span> 
     <span class="icon-bar"></span> 
     <span class="icon-bar"></span> 
     <span class="icon-bar"></span> 
     </button> 
     <a class="navbar-brand" href="{% url 'index' %}">MyWeb</a> 
    </div> 

    <!-- Collect the nav links, forms, and other content for toggling --> 
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> 
     <ul class="nav navbar-nav"> 


     </ul> 

I

{% if user.is_authenticated %} 
<a href="{% url 'userena_profile_detail' user.username %}" style="color:white">profile<i class="fa fa-user"></i></a></li> 
    <li><a href="/accounts/signout" style="position:relative; right:15px; color:white">else</a> 
{% else %} 
    <li><a href="/accounts/signup/"style="color:white">signin<i class="fa fa-registered"></i></a></li> 
    <li><a href="/accounts/signin/" style="position:relative; right:15px; color:white">login<i class="fa fa-sign-in"></i></a></li> 

    {% endif %} 
hinzufügen müssen

Wie mache ich das? Ich will nichts, wenn es in Desktop-Version ist, ich will nur diese einfach setzen, wenn es in xs ist und ich Toggle-nav-Menü

Antwort

1

Try this:

<nav class="navbar navbar-default visible-xs-block"> 

Auch Sie für Ihre Referenz kann andere Option von Bootstrap viewport breakpoints finden

Hoffe es hilft :)

Verwandte Themen