how to make div click-able?

前端 未结 9 1129
春和景丽
春和景丽 2020-12-08 07:15
shanghaimale

For div like above,when mouse on,it should become cursor:poin

9条回答
  •  被撕碎了的回忆
    2020-12-08 07:58

    I suggest to use a CSS class called clickbox and activate it with jQuery:

    $(".clickbox").click(function(){
         window.location=$(this).find("a").attr("href"); 
         return false;
     });
    

    Now the only thing you have to do is mark your div as clickable and provide a link:

    
    

    Plus a CSS style to change the mouse cursor:

    .clickbox {
        cursor: pointer;
    }
    

    Easy, isn't it?

提交回复
热议问题