0
좋아, 제목과 설명이있는 그림을 표시하는 앱을 만듭니다. 여기에django에서 적절한 링크가 작동하지 않습니다.
{% block content %}
<!-- MODAL IMAGE - This is the preview -->
{% if projects %}
{% for project in projects %}
<div class="col-md-4 ">
<div class="grid mask">
<figure>
<img class="img-responsive" src="{{ project.preview.url }}" alt="">
<figcaption>
<h5>{{ project.title }}</h5>
<a data-toggle="modal" href="#modal1" class="btn btn-primary btn-lg">Take a Look</a>
</figcaption><!-- /figcaption -->
</figure><!-- /figure -->
</div><!-- /grid-mask -->
</div><!-- /col -->
<!-- MODAL DETAIL - This is suppos to show the details -->
<div class="modal fade" id="modal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">{{ project.title }}</h4>
</div>
<div class="modal-body">
<p><img class="img-responsive" src="{{ project.preview.url }}" alt=""></p>
<p>Category: {{ project.category }}</p>
<p>Detail: {{ project.detail }}</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
{% endfor %}
{% endif %}
{% endblock %}
그래서 앱이 작동하고 있으므로 새 프로젝트 이미지를 추가하면 생성 된 모든 프로젝트의 미리보기가 표시됩니다. 그러나 "Take a look"을 클릭하면 팝업 창은 보이지만 이미지와 제목은 항상 첫 번째 이미지와 제목을 나타냅니다. 내 짧은 모달 자세로 모든 첫 번째 이미지와 제목을 참조하십시오.
감사합니다. eak,
). 이것은 아마 여러분이 jquery 함수를 수정하여 이들 새로운 모달을 목표로해야 할 필요가 있음을 의미합니다. – rnevius
이것은 부트 스트랩 코드처럼 보입니다. ''노드의 'href' 속성에서 모달 요소의 ID를 취해야하므로 JS를 변경할 필요가 없을 것입니다. – lanzz
그래, 그건 부트 스트랩이야, 내가 장고와 함께 작동하도록 노력하고있어 :) – eakdev