Created
July 31, 2013 20:24
-
-
Save espen/6125807 to your computer and use it in GitHub Desktop.
fullcalendar annotations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Global Annotation Styles | |
------------------------------------------------------------------------*/ | |
.fc-annotation { | |
border-style: solid; | |
border-width: 0; | |
font-size: .85em; | |
cursor: default; | |
} | |
.fc-annotation-skin { | |
border-color: #999; /* default BORDER color */ | |
background-color: #edb; /* default BACKGROUND color */ | |
color: #777; /* default TEXT color */ | |
text-align: center; | |
opacity: 0.8; | |
filter: alpha(opacity=80); /* for IE */ | |
} | |
.fc-annotation.closed { | |
background-color: #f1f1f1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function renderAnnotations(view,annotations) { | |
var container = $(view.element).find('.fc-agenda-slots').parent(); | |
if ( container.find('#annotationSegmentContainer').length === 0 ) { | |
annotationSegmentContainer = $("<div style='position:absolute;z-index:-1;top:0;left:0' id='annotationSegmentContainer'>").prependTo( container ); | |
} | |
else { | |
annotationSegmentContainer = container.find('#annotationSegmentContainer'); | |
} | |
var html = ''; | |
for (var i=0; i < annotations.length; i++) { | |
var ann = annotations[i]; | |
if (ann.start >= view.start && ann.end <= view.end) { | |
var top = view.timePosition(ann.start, ann.start); | |
var bottom = view.timePosition(ann.end, ann.end); | |
var height = bottom - top; | |
var dayIndex = $.fullCalendar.dayDiff(ann.start, view.visStart); | |
var left = view.colContentLeft(dayIndex) - 2; | |
var right = view.colContentRight(dayIndex) + 3; | |
var width = right - left; | |
var cls = ''; | |
if (ann.cls) { | |
cls = ' ' + ann.cls; | |
} | |
var colors = ''; | |
if (ann.color) { | |
colors = 'color:' + ann.color + ';'; | |
} | |
if (ann.background) { | |
colors += 'background:' + ann.background + ';'; | |
} | |
var body = ann.title || ''; | |
html += '<div style="position: absolute; ' + | |
'top: ' + top + 'px; ' + | |
'left: ' + left + 'px; ' + | |
'width: ' + width + 'px; ' + | |
'height: ' + height + 'px;' + colors + '" ' + | |
'class="fc-annotation fc-annotation-skin' + cls + '">' + | |
body + | |
'</div>'; | |
} | |
} | |
annotationSegmentContainer.html(html); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add to line 1255 | |
// or add to top of date_util.js if you are building manually | |
fc.dayDiff = dayDiff; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In fullcalendar.js file of main file i dont find the place where i can add the above lines.please let me know where to add fc.dayDiff in latest version of fullcalendar.js file