0

AngularJs で水平メニューを作成しようとしています。ボタンをクリックしてメニューをフェードアウトしたい。css3トランジションでフェードアウトを実現したいのですがうまくいきません。

これは実際のコードです:

<div class="header-title" ng-bind="pageTitle">
</div>
<div class="content-container" ng-controller="AboutCtrl">
    <div class="navigation-container"  ng-show="checked">
        <li ui-route="/services" ng-class="{active:$uiRoute}" class="navigation-item"><a
                href="#/services">Services</a>
        </li>
        <li ui-route="/services" ng-class="{active:$uiRoute}" class="navigation-item"><a
                href="#/services">Services 1</a>
        </li>
        <li ui-route="/services" ng-class="{active:$uiRoute}" class="navigation-item"><a
                href="#/services">Services 2</a>
        </li>
    </div>
<div class="navbar navbar-inverse">
    <div class="navbar-inner">
        <button ng-init="checked=false" ng-click="checked=!checked" type="button" class="btn btn-navbar">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>
    </div>
</div>

<div>content</div>

</div>

実際、私のCSSは次のようになります。

.navigation-container{
max-height:600px;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}

.header-title{
background-color: #dddddd;
padding: 15px 20px;
text-align: center;
color: #333333;
font-weight: bold;
font-size: 20px;
}

.navigation-item{
list-style:none;
background-color: white;
text-align: center;
color: #777777;
font-size: 12px;
font-weight: normal;
line-height: 1.4;
border-bottom:dotted 1px #dddddd;
}

.navigation-item > a {
padding: 15px;
display: block;
-webkit-transition: all 0.3s ease-out;
    -moz-transition: all 0.3s ease-out;
    -ms-transition: all 0.3s ease-out;
    -o-transition: all 0.3s ease-out;
    transition: all 0.3s ease-out;
}

.navigation-item > a:hover{
background-color: #eeeeee;
text-decoration:none;
}

ボタンをクリックしてクラス「navigation-container」をフェードアウトしたい。このためのcssを実行するのを手伝ってくれる人はいますか?

4

1 に答える 1

0

これは、ボタンのクリックに基づいて要素にスタイルを適用する方法を示すフィドルです

http://jsfiddle.net/5vYzD/3/

HTML

<div ng-controller="MyCtrl">
   <div class='box' ng-class='{"first": selected==1, "second": selected==2}'>Hello</div>

   <button ng-click='selected=1'>Apply first style</button>
   <button ng-click='selected=2'>Apply second style</button>
</div>
于 2013-10-29T14:10:55.053 に答える