私はjqueryに悩まされており、少し初心者なので、ここに私の問題があります:
ドロップ ダウン パネル メニューを作成しています。ドロップ ダウンは問題ありませんが、クリックしてアクションをトリガーする div 内にネストされている div の背景画像に影響を与える必要があります。つまり、「.side_bar_top_text」は、背景を変更する必要がある div です。
jquery:
<script type="text/javascript">
$(document).ready(function () {
$('.side_bar_top').click(function(){
if ($(this).attr('class') != 'active'){
$('.side_bar .side_bar_panel', this).slideUp();
$(this).next().slideToggle();
$(this).removeClass('active');
$(this).addClass('active');
}
});
});
</script>
html:
<div class="side_bar_top"><div class="side_bar_top_text">COMMERCIAL CONSTRUCTION</div></div>
<div class="side_bar">
<div class="side_bar_panel">
/*the list of elements*/
</div>
</div>
私がする必要があるのは、パネルがアップしているときに CSS を介して side_bar_top_text の背景イメージを変更することと、その逆です。運が悪いので、さまざまな方法を試しました。誰でも助けることができますか?