AngularJS Nav Menu step by step

index.html
----------

<!DOCTYPE html>
<html>
<head>
        <meta charset="utf-8"/><link href="http://fonts.googleapis.com/css?family=Open+Sans:400,700" rel="stylesheet" />
        <link href="style.css" rel="stylesheet" />
</head>
<body ng-app="">

            <h1> Angular King</h1>
        <nav class="{{active}}" ng-click="$event.preventDefault()">

            <a href="#" class="home" ng-click="active='home'">Home</a>
            <a href="#" class="about" ng-click="active='about'">About</a>
            <a href="#" class="contact" ng-click="active='contact'">Contact</a>
            <a href="#" class="Gallary" ng-click="active='Gallary'">Gallary</a>
            <a href="#" class="Category" ng-click="active='Category'">Category</a>
            <a href="#" class="Product" ng-click="active='Product'">Product</a>
            <a href="#" class="Faq" ng-click="active='Faq'">Faq</a>
        </nav>
        <p ng-show="active">You chose <b>{{active}}</b></p>
        <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
        <h2><a href="http://gtumcabca.blogspot.in/">http://gtumcabca.blogspot.in/</a></h2>
</body>
</html>
---------------------------------------------

style.css
--------
/*-------------------------
    Simple reset
--------------------------*/


*{
    margin:0;
    padding:0;
}


/*-------------------------
    General Styles
--------------------------*/


body{
    font:15px/1.3 'Open Sans', sans-serif;
    color: #5e5b64;
    text-align:center;
}

a, a:visited {
    outline:none;
    color:#389dc1;
}

a:hover{
    text-decoration:none;
}

section, footer, header, aside, nav{
    display: block;
}


/*-------------------------
    The menu
--------------------------*/


nav{
    display:inline-block;
    margin:60px auto 45px;
    background-color:#55B460;
    box-shadow:0 1px 1px #ccc;
    border-radius:2px;
}

nav a{
    display:inline-block;
    padding: 18px 30px;
    color:#fff !important;
    font-weight:bold;
    font-size:16px;
    text-decoration:none !important;
    line-height:1;
    text-transform: uppercase;
    background-color:transparent;

    -webkit-transition:background-color 0.25s;
    -moz-transition:background-color 0.25s;
    transition:background-color 0.25s;
}

nav a:first-child{
    border-radius:2px 0 0 2px;
}

nav a:last-child{
    border-radius:0 2px 2px 0;
}

nav.home .home,
nav.team.team,
nav.about .about,
nav.contact .contact{
    background-color:#5867E3;
}

p{
    font-s
    color:#7d9098;
}

p b{
    color:#ffffff;
    display:inline-block;
    padding:5px 10px;
    background-color:#DC64C6;
    border-radius:2px;ize:22px;
    font-weight:bold;
    text-transform:uppercase;
    font-size:18px;
}


output
-------
AngularJS Nav Menu step by step

Share on Google Plus

About quora Questions & Answers A-Z

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment