I have nearly completed a crucial section in my Django project by implementing panels
that contain a set of cards
. Using Bootstrap 3 (BS3)
, I have integrated cards from BS4
into BS3
.
Encountering a peculiar issue, I seek advice from the community due to the strange behavior observed.
The Challenge :
Upon opening the dropdown from Publication n°1 and Publication n°2, there is an offset visible in the animated image below, affecting the cards in the second row.
[![see animated image][1]][1]
My inquiry is: How can I reconfigure the bootstrap components in my code to rectify this abnormal behavior?
Desired Card Behavior:
My objective for each card is to: open the card > create an offset for the entire row below
[![desired card effect][2]][2]
Undesired Behavior:
This is the kind of behavior I want to avoid:
[![undesired behavior][3]][3]
Code snippet :
The following represents my code:
{% for category in research_categories|dictsort:'name' %}
<div class="panel-group accordion" id="accordion_{{ category.id }}" role="tablist"
aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion_{{ category.id }}"
href="#collapseOne_{{ category.id }}" aria-expanded="true" aria-controls="collapseOne">
<i class="more-less glyphicon glyphicon-plus"></i>
{{ category }}
{% for item in category.publication.all %}
{% if item.new_publication == True %}
<span class="glyphicon glyphicon-flag"></span>
{% endif %}
{% endfor %}
</a>
</h4>
</div>
<div id="collapseOne_{{ category.id }}" class="panel-collapse collapse" role="tabpanel"
aria-labelledby="#accordion_{{ category.id }}">
<div class="panel panel-default subpanel ">
<div class="row">
{% for element in research_publications|dictsort:'pub_id' %}
{% if element.category|stringformat:"s" == category|stringformat:"s" %}
<div class="col-md-4">
<div class="card" style="width:350px">
<img class="card-img-top" style="width: 350px; height: 350px" src="{{ element.cover.url }}" alt="Card image">
<div class="card-body">
<h4 class="card-title">{{ element }} - {{ element.pub_id }}
{% if element.new_publication == True %}
<span class="glyphicon glyphicon-flag"></span>
{% endif %}
</h4>
<button class="btn btn-default display-document" type="button" data-toggle="collapse"
data-target="#dropdown_{{ element.id }}"
aria-expanded="false"><span
class="glyphicon glyphicon-chevron-down"></span></button>
<div id="dropdown_{{ element.id }}" class="collapse">
<div class="publication-title">
<table class="table table-condensed">
<tbody>
{% for item in test_research %}
{% if item.publication|stringformat:"s" == element|stringformat:"s" %}
<tr>
<td class="col-md-5 document-title">{{ item.title }}</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
{% endif %}
{% endfor %}
</div>
</div>
</div>
</div>
</div>
{% endfor %}
The code snippet above is a simplified version of my initial code for the purpose of troubleshooting.
Feel free to request my CSS segment if needed; however, I suspect the issue stems from the bootstrap grid configuration. Your assistance is greatly appreciated!
Thank you in advance!