Friday, April 12, 2013

Small Calendar for SharePoint 2010 & 2013

First off I would like to apologize for the lack of posts. I have been really busy with my new role as the UX Design lead within Slalom Consulting Boston. I will share more about that in another post.

In a previous post Create Really Small Calendar I showcased how to do this for SharePoint 2007. However the 2010 and 2013 calendar views have changed and therefore we cannot use the same method or CSS as 2007.

SharePoint 2010 Small Calendar:
image

SharePoint 2013 Small Calendar:
image

See video below for a video walk through on how to create a small calendar for SharePoint 2010 and & SharePoint 2013 with just CSS.

Per the video above here is the code that I referenced:

2010 CSS link reference in Master Page:
<SharePoint:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/smallcalendar.css %>" After="corev4.css" runat="server"/>

2010 CSS:
/**** Small Calendar ***/
.ms-acal-item{height: 10px !important;}
.ms-acal-sdiv,
.ms-acal-mdiv,
.ms-acal-ctrlitem,
.ms-acal-month-weeksel,
.ms-acal-title{display: none;}
.ms-acal-summary-itemrow TD DIV{height: 15px !important;}

2013 Content Editor Web Part CSS:
<style>
/**** Small Calendar ***/
.ms-acal-item{height: 10px !important;}
.ms-acal-sdiv,
.ms-acal-mdiv,
.ms-acal-ctrlitem,
.ms-acal-month-weeksel,
.ms-acal-title,
.ms-acal-month-top span{display: none;}
.ms-acal-summary-itemrow TD DIV{height: 15px !important;}
</style>

Thanks & Enjoy!

16 comments:

Thakhi Shaik said...

Hello Eric,

Is it possible to color date background dynamically instead of event background?

Thanks,
Thakhi

Erik Swenson said...

Thakhi, I have not tried this but I bet you could absolute or relative position the color blocks over the dates and set the z-index to go under the numbers.

Thakhi Shaik said...

Thank You Erik..

Can you please post some sample code

williams said...

Thanks you Erik
for the very useful calendar small,
as should make a css for a small newsfeed

jebz said...

Hey, Erik, thanks so much for sharing! I just wanted to share this extra css statement that I use to get rid of the "Add" button that appears when you hover.

.ms-acal-vlink a{display:none;}

Not sure if it works in 2010, but I am using it in 2013.

I am also wondering, what do you, personally, do about the click events that fire when a user clicks on the day of the month (6,7,8...)?

Joakim Wåhlander said...

I have a problem. If you have more than one event for a day, only the first event is showing if the height specified in .ms-acal-item is too small. The following events aren't even loading.

Any solution or suggestion for how to solve this?

Erik Swenson said...

Joakim, that is a known limitation with this simple approach. I have tried many times to show the other events in a condensed view but the way the event items are positioned it is impossible for the containing element to know there are more elements. You could remove the .ms-acal-summary-itemrow TD DIV{height: 15px !important;} height but then you would have a very tall and thin calendar.

blarencebutt said...

showing schedule views in calendar

Sqiar BI said...

It's actually a cool and useful piece of info. I am glad that you simply shared this useful info with us. Please keep us up to date like this. Thanks for sharing, You can also check out this http://www.sqiar.com/services

Corina Honegger said...

Hi Erik

Thanks a lot for your post, it was very helpful for rendering my SPCalendar. The only bug i still get is when clicking on Prev/Next Button the events have the old layout and won't match to the calendar grid anymore. After re-sizing the page they match again. Do you have any idea how to get rid of this bug?
Thanks,Corina

Igor Pacheco said...

Thank you !!!

Philipp Kuderer said...

Hi,
is it possible that the day numbers dont have a link?
So that the day view dont open when I click on a number.

Thanks

Darsh Antani said...

Hi,

Is It possible to get Event Title and Description or any other things on "Mouse Hover" in SharePoint 2013 Calendar Template?

Thanks in Advance.

Baldo said...

Great post!

But, when I use this css for sharepoint 2013 this runs perfectly in IE9 and Chrome. But when I use this code in IE11, no runs correctly. I need put IE11 in compatibilty mode view. Any Idea?

Thank you!

Thomas Kelly said...

Hi Erik,

Back to this point. When you have two calendar events on the same day, there is a space between the calendar items and I can't find a way to remove it. Any chance you know? Your video has been really helpful so far.

Thanks,

Tom

Mike Malloy said...

Nice work! Do you know a way of forcing the web part to show a specific month? I want to add 12 web parts to one page so I can see the same calendar with all 12 months exposed at once.