One quick solution can be to use a flag to check for the first foreach value something like this:
@if(flag==<some_value>)
....
<reset flag>
....
<div id="{{$special->id}}" class="panel-collapse collapse in">
<div class="panel-body">
{{ $special->content }}
</div>
</div>
@else
.....
.....
<div id="{{$special->id}}" class="panel-collapse collapse">
<div class="panel-body">
{{ $special->content }}
</div>
</div>
@endif
Or if you know the value returned by $special->id, you can compare that.
you could always use the :first-child css selector and target the first accordian and give it classes that make accordian open..
I'm not able to do that and if I try to use jquery my alert doesn't happen.
jquery
$(".panel-title a").click(function(){
alert("yay");
});
I use this snippet for the same thing:
<div id="" class="panel-collapse collapse {{ ($special == head($content->special)) ? 'in' : '' }}">
...
</div>
What do you mean? Is there an error? Are the closed accordions shown? Is anything shown?
There is no error, the accordions is still closed and when I check firebug I still have
<div id="2" class="panel-collapse collapse ">
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community