Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
701 views
in Technique[技术] by (71.8m points)

jquery - Add Icon(s) in first line of an event (fullCalendar)

For specific attributes of an event to be displayed in the 'fullCalendar' matrix I would like to add icons to show them, for 'completed' an (i) button, or an URL symbol in case the event contains an URL link.

I don't want to write any html string to one of the elements (fc-event-time/-title) in the <a> element, but define an additional element like this:

<a>
  <span class="fc-event-time">15:15  - 16:15<br></span>
  **<span class="fc-event-icons"> ..some definitions for icons here ..</span>**
  <span class="fc-event-title">Fri Dille</span>
</a>

Any help here? Günter

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Well this topic is old, but I couldn't find here how to do it with <img> tags so I leave here another way to put images in fullcalendar events:

Add in your eventObject a path to the image. If you use javascript it would be something like:

events: [
    {
        title  : 'event1',
        start  : '2010-01-01',
        imageurl:'img/edit.png'
    },
    {
        title  : 'event1',
        start  : '2010-01-01'
    }]

Then on eventRender just put the image:

eventRender: function(event, eventElement) {
    if (event.imageurl) {
        eventElement.find("div.fc-content").prepend("<img src='" + event.imageurl +"' width='12' height='12'>");
    }
},

If you want to use the same image on all items, you just need to put this in your eventRender:

eventElement.find("div.fc-content").prepend("<img src='pathtoimage.png' width='12' height='12'>");

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...