Which expands and collapses on click. Now I want to toggle an image along with it, which is a css background element. I am not able to figure out how.
<script>
$(document).ready(function(){
$(".panel_head").click(function(){
//$(this).slideToggle("slow");
$(this).next('div').slideToggle('slow', function() {
});
var myEl = $(this);
var bgimg = myEl.css('background');
if( bgimg === #00b0f0 url('http://localhost:8383/Buzz_HomePage/images/white_down_arrow.png') 5% center no-repeat ) {
myEl.css({ 'background' : #00b0f0 url('http://localhost:8383/Buzz_HomePage/images/white_down_arrow.png') 5% center no-repeat });
} else {
myEl.css({ 'background' : #00b0f0 url('http://localhost:8383/Buzz_HomePage/images/white_down_arrow.png') 5% center no-repeat });
}
});
});
</script>
This is my css
.panel_head {
border-radius: 0 !important;
color: white;
font-size: 14pt;
background: #00b0f0 url('http://localhost:8383/Buzz_HomePage/images/white_down_arrow.png') 5% center no-repeat;
text-align: center;
cursor: pointer;
}
And this is my html
<div class="panel custom_panel">
<div class="panel-heading panel_head" id="panel-head1">
<span class="expand-collapse-text exp" >
Categories
</span>
</div>
<div class="panel-body" id="panel-body1">
<ul class="left_options list-unstyled">
<li> <input value="1" id="ca1" class="handleclick" type="checkbox" name="ca"><label for="ca1"><span></span>ALL(A-Z Listing)</label> </li>
<li> <input value="2" id="ca2" class="handleclick" type="checkbox" name="ca"><label for="ca2"><span></span>Health Check Up</label> </li>
<li> <input value="3" id="ca3" class="handleclick" type="checkbox" name="ca"><label for="ca3"><span></span>Treatment</label> </li>
<li> <input value="16" id="ca16" class="handleclick" type="checkbox" name="ca"><label for="ca16"><span></span> Procedure </label> </li>
</ul>
</div>
</div>
I am getting errors in my script.