遇到一個奇怪的問題,得到了一條直線(足夠)的導航欄,我試圖隱藏,但是當我調用autoHidingNavbar時,命令(或其中之一)。bootstrap autoHideNavbar會導致TypeError:undefined不是函數
<script>
$('.navbar-fixed-top').autoHidingNavbar('setAnimationDuration',300);
//$('.navbar-fixed-top').autoHidingNavbar('hide');
</script>
的錯誤:
TypeError: undefined is not a function
at eval (eval at <anonymous> (http://127.0.0.1:30016/bower_components/jquery/dist/jquery.min.js:2:2538), <anonymous>:2:28)
at eval (native)
at Function.n.extend.globalEval (http://127.0.0.1:30016/bower_components/jquery/dist/jquery.min.js:2:2538)
at n.fn.extend.domManip (http://127.0.0.1:30016/bower_components/jquery/dist/jquery.min.js:3:17228)
at n.fn.extend.append (http://127.0.0.1:30016/bower_components/jquery/dist/jquery.min.js:3:14886)
at null.<anonymous> (http://127.0.0.1:30016/bower_components/jquery/dist/jquery.min.js:3:16246)
at n.access (http://127.0.0.1:30016/bower_components/jquery/dist/jquery.min.js:2:30124)
at n.fn.extend.html (http://127.0.0.1:30016/bower_components/jquery/dist/jquery.min.js:3:15917)
at link (http://127.0.0.1:30016/bower_components/angular-route/angular-route.js:969:16)
at invokeLinkFn (http://127.0.0.1:30016/bower_components/angular/angular.js:8258:9) <div ng-view="" class="ng-scope">
我發現了一些指標早期版本的引導或jQuery的的可能會導致此,或他們的加載順序 以便爲命令,一切OK:
<script type="text/javascript" src="/bower_components/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src='/bower_components/angular/angular.js'></script>
<script type="text/javascript" src='/bower_components/angular-route/angular-route.js'></script>
<script type="text/javascript" src='/bower_components/angular-route/angular-route.js'></script>
<script type="text/javascript" src='/bower_components/angular-resource/angular-resource.js'></script>
<script type="text/javascript" src='/bower_components/jquery/dist/jquery.js'></script>
<script type="text/javascript" src='/bower_components/bootstrap/dist/js/bootstrap.min.js'></script>
<script type="text/javascript" src='/javascripts/BabyPadz.js'></script>
和菜單部分它的自我
<footer>
<div class="navbar navbar-topbaby navbar-fixed-bottom">
<div class="container text-center">
<div class="center-block">
<div class="navbar-header">
<a href="/music"><button type="button" class="btn btn-xlarge" ng-style="{'background-color' : bgMusic}">MUSIC</button></a>
<a href="config"><button type="button" class="btn btn-xlarge" ngStyle={'background-color' :bgConfig}>CONFIG</button></a>
<button type="button" class="btn btn-xlarge" ngStyle={'background-color' :bgLogin}>LOGIN</button>
<a href="/about"><button type="button" class="btn btn-xlarge" ngStyle={'background-color' :bgAbout}>ABOUT</button></a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".bottom-collapse"> <!-- NOTE! data-target was changed to .bottom-collapse -->
</div>
</div>
<div class="navbar-collapse collapse bottom-collapse"> <!-- NOTE! The extra bottom-collapse class put on here -->
</div><!--/.nav-collapse -->
</div>
</div>
</footer>
更新
反饋之後,我清理腳本加載
<script type="text/javascript" src='/bower_components/jquery/dist/jquery.js'></script>
<script type="text/javascript" src="/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src='/bower_components/angular/angular.js'></script>
<script type="text/javascript" src='/bower_components/angular-route/angular-route.js'></script>
<script type="text/javascript" src='/bower_components/angular-resource/angular-resource.js'></script>
<script type="text/javascript" src='/javascripts/BabyPadz.js'></script>
,改變了呼叫
$('.navbar-fixed-bottom').autoHidingNavbar('setAnimationDuration',300);
$('.navbar-fixed-bottom').autoHidingNavbar('hide');
唉無濟於事
UPDATE:
前進一步,沒有更多的錯誤消息,autoHidingNavbar是一個引導模塊。已經錯過了加
奇怪的是,我現在沒有錯誤消息,但酒吧還是不隱藏..
沒有任何東西(但可能應該已經清理了幾年前:) – vrghost