Add font awesome icon to full calendar title

后端 未结 6 1145
不思量自难忘°
不思量自难忘° 2020-12-15 23:41

I\'m using wordpress, formidable forms and full calendar to create a bespoke calendar solution

I have everything working except for I\'d like to add a font awesome i

6条回答
  •  执念已碎
    2020-12-16 00:07

    Had the same issue with Full Calendar 4.4. I try to use the code from S.Poppic

    eventRender: function (info) {
      let icon = info.event.extendedProps.icon;
      let title = $(info.el).first('.fc-title-wrap');
      if (icon !== undefined) {
        title.prepend("");
      }
    }
    

    It works with a little issue: .fc-title-wrap removes the "time"

    Then I see another answer from here that points to class '.fc-title' and it works, but not for the listview in FullCalendar 4.4

    I used the following code and it worked for me, for month view, weekview, dayview and list view.

    As you can see it is based on some of the answers I found here. Hope it helps.

     eventRender: function (info) {            
            let icon = info.event.extendedProps.icon;
            // this works for Month, Week and Day views
            let title = $(info.el).find('.fc-title');
            // and this is for List view
            let title_list = $(info.el).find('.fc-list-item-title a');
    
            if (icon) {
                var micon = " ";
                title.prepend(micon);
                title_list.prepend(micon);
            } 
      }
    

提交回复
热议问题