1

미리 도움을 주셔서 감사합니다!twitter 부트 스트랩 드롭 다운이 장고 템플릿에서 작동하지 않습니다.

제 문제는 트위터 부트 스트랩의 드롭 다운 메뉴 (navbar 용)가 저에게 효과적이지 않고 현재 매우 잃어버린 것입니다. 내 헤더 코드 (그래서 그래, 난 자신의 .js을 포함하고 전화 않음) :

<head> 
    <title>{% block title %}User test{% endblock %}</title> 
    <!--for IE6-8 support of HTML elements --> 
    <!--[if lt IE 9]> 
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> 
    <![endif]--> 

    <script type="text/javascript" src="http://twitter.github.com/bootstrap/assets/js/bootstrap-dropdown.js"></script><!--dropdown addon--> 
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script><!--jquery--> 
    <script type="text/javascript"> 
     $(document).ready(function(){ 
     $('.dropdown-toggle').dropdown(); 
    }); 
    </script> 

    <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}style.css" /><!--link to my style.css--> 
    <link rel="stylesheet" type="text/css" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" /><!--link to bootstrap's css--> 

드롭 다운 가질 생각되는 메뉴 항목 : 다시

 <ul class="nav"> 
       <li class="dropdown"> 
        <a href="#" class="dropdown-toggle" data-toggle="dropdown"> 
         {% trans "Logged in" %}: {{ user.username }} 
         <b class="caret"></b> 
        </a> 
        <ul class="dropdown-menu"> 
         <li><a href="{% url auth_password_change %}">{% trans "Change password" %}</a></li> 
         <li><a href="{% url auth_logout %}">{% trans "Log out" %}</a></li> 
        </ul> 
       </li> 
       <li><a href="/upload/">{{ "Upload your CVS" }}</a></li> 
       <li><a href="/settings/">{% trans "Settings" %}</a></li> 
     </ul> 

감사합니다,

blargie - 즐

답변

6

스위치 당신의 js의 순서가 너무 jQuer을 포함 y가 먼저로드됩니다.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script><!--jquery--> 
<script type="text/javascript" src="http://twitter.github.com/bootstrap/assets/js/bootstrap-dropdown.js"></script><!--dropdown addon--> 
+0

을 사용해 주셔서 감사합니다.하지만 여전히 작동하지 않습니다. –

0

존 저는 실제로 선을 변경해야한다고 말했습니다. 어떤 마법적인 이유로 (아직도 이유는 모르겠다!) 심지어 설정되지 않은 중단 점에서 깨져서 jquery가 로딩되지 않았다. 브라우저를 재부팅하면 제대로 작동합니다.

2

마지막 버전의 jquery (1.7)

+0

도 작동하지 않았습니다. 나는 1.7.1로 전환했다. 그리고 나서 코드의 맨 처음에 깨질 것이다 ... 나는 기본적으로 크롬을 다시 시작해야했다. –

+0

그것은 1.8.3과 나를 위해 일 했어요. –

관련 문제