Want to make Font Awesome icons clickable

前端 未结 7 2196
伪装坚强ぢ
伪装坚强ぢ 2020-12-12 23:45

So I am new to web development and I am trying to link font awesome icons to my social profiles but am unsure of how to do that. I tried using an a href tag but it made all

7条回答
  •  失恋的感觉
    2020-12-13 00:27

    In your css add a class:

    .fa-clickable {
        cursor:pointer;
        outline:none;
    }
    

    Then add the class to the clickable fontawesome icons (also an id so you can differentiate the clicks):

     
     
     
     
     
    

    Then add a handler in your jQuery

    $(document).on("click", "i", function(){
        switch (this.id) {
            case "epd-dribble":
                // do stuff
                break;
            // add additional cases
        }
    });
    

提交回复
热议问题