change cursor to finger pointer

前端 未结 10 2087
孤街浪徒
孤街浪徒 2021-01-30 15:17

I have this a and I don\'t know that I need to insert into the \"onmouseover\" so that the cursor will change to finger pointer like a regular link:



        
10条回答
  •  北海茫月
    2021-01-30 15:47

    Solution via pure CSS as mentioned in answer marked as the best is not suitable for this situation.

    The example in this topic does not have normal static href attribute, it is calling of JS only, so it will not do anything without JS.

    So it is good to switch on pointer with JS only. So, solution

    onMouseOver="this.style.cursor='pointer'"
    

    as mentioned above (but I can not comment there) is the best one in this case. (But yes, generaly, for normal links not demanding JS, it is better to work with pure CSS without JS.)

提交回复
热议问题