change background of parent div on hover

前端 未结 6 1155
情书的邮戳
情书的邮戳 2020-12-31 13:05

I have this code:

6条回答
  •  被撕碎了的回忆
    2020-12-31 13:27

    CSS selectors can not ascend, so you will need to use JavaScript.

    You tagged it jquery so here is a jQuery answer.

    $('.thumb_image_holder_orange img').mouseover(function() {
        $(this).parent().css('backgroundImage', 'url(/whatever/you/want.png)');
    });
    

提交回复
热议问题