0
I am developing a javascript action to minimize and return a div to normal size,and it is working correctly, my only difficulty is to leave this action unique by pressing the "button". What is happening is when on a "button" the action is done on all Ivs. I will try to explain better with images.
When I click on any of the buttons, the action is executed on everyone, I would like it to be just what I clicked.
Code of the div:
<div class="row" style="margin-top: 20px;">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-heading">
<button class="btn-minimize"></button>
<img src="<?php echo $this->crud_model->get_image_url($post['created_by'], $post['created_by_' . $post['created_by']]);?>">
<span class="name"><?= $creator->name ?> <small style="font-weight: 500;">/ publicado para: <b><?= $postClassName ?></b> na categoria <b><i class="<?= $category->icon ?>"></i> <?= $category->name ?></b></small></span>
<span class="date"><?= $post['created_at'] ?></span>
</div>
<div class="panel-body">
Code for javascript/jquery:
$(".btn-minimize").click(function(){
$(this).toggleClass('btn-plus');
$(".panel-body").slideToggle();
});
Show!!! Thank you very much. It worked perfectly.
– user144209
Smart the solution, thanks too.
– ElvisP