我有一个页面,其中我将产品显示到表格中,每行都有一个按钮来显示模式,该模式显示产品的图像,模式显示得很好,但是在其外部单击甚至按关闭按钮时也不会消失!(我知道上面的代码中没有关闭按钮)
<tbody>
@foreach($table_data as $product)
<tr>
<td>{{ $product->id }}</td>
<td>{{ $product->name }}</td>
<td class="text-right">{{ getCategoryType($product->taggable_type) }}</td>
<td>{{ ($product->discount*100)."%" }}</td>
<td>{{ $product->price }}</td>
<td>{{ $product->is_decorated ? 'Complex' : 'Simple' }}</td>
<td class="align-content-center">
<button type="button" class="btn btn-success btn-sm m-b-10 m-l-5" data-toggle="modal" data-target="#myModal{{$loop->index}}">Image</button>
<div id="myModal{{$loop->index}}" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel{{$loop->index}}" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<img src="{{asset('Images/products/'.$product->id.".jpg")}}" class="img-responsive">
</div>
</div>
</div>
</div>
<button type="button" class="btn btn-success btn-sm m-b-10 m-l-5">Edit</button>
<button type="button" class="btn btn-danger btn-sm m-b-10 m-l-5">Delete</button>
</td>
</tr>
@endforeach
答案 0 :(得分:1)
尝试添加关闭模式按钮,例如:
<button type="button" class="btn btn-gray btn-circle" data-dismiss="modal">Dismiss</button>