Live demo: holiday calendar

I got a couple questions about the holiday calendar displayed on my demo site, so here is the recipe.

The ingredients are already on this blog:
- how to shrink the calendar month view
- how to display HTML in a calendar view
- how to include a hover effect

So as usual add a CEWP to the page, under the calendar, where you’ll paste the CSS to shrink the calendar and the script to render the HTML.

Here is the formula I used for my demo:

="<DIV style='position: relative;margin:-4px;' onMouseOver='document.getElementById("""&Title&""").style.display=""""' onMouseOut='document.getElementById("""&Title&""").style.display=""none""'><DIV style='height:10px;overflow-y:hidden;' ><IMG style='width:20px;' src='"&Picture&"' /></DIV><DIV id='"&Title&"' style='display:none;position: absolute; top:-60px; left:-110px;background-color:navajowhite;border-width:thick;border-style:ridge;'><IMG style='width:86px;' src='"&Picture&"' />
"&Title&"</DIV></DIV>"

Where [Picture] is a column of type text containing the link to the displayed picture.

Note that the hover effect works well in Internet Explorer, but there are rendering issues in Firefox.

About these ads
    • Eli
    • November 25th, 2008

    thankyou, thankyou, thankyou your awesome. i see now my DIV style was off.

    Eli

    • cis
    • December 4th, 2008

    I seem to running into a small situation. Everything works well for except I’m not able to see the picture on the title name. Any suggestions??? Thank you so much your postings are incredible.

  1. cis, did you double check the link to your picture? And what is your browser? Feel free to send me a screenshot and more details at Christophe@PathToSharePoint.com

    • theerdman
    • August 24th, 2009

    Great site and great tricks. I have a quick question regarding the placement of the icons in the small calendar. How are you getting your icons centered on the day of th week? I am having an issue with the icon being partially cropped and coming up into the header portion of the day. All help is greatly appreciated.

    • I am not sure I understand your question, but anyway here is some more information on the screenshot: to make the icon fit in the day cell, I forced the height of the div (10px) and the width of the icon (20px), and included overflow-y:hidden in the style. So if you take a closer look at the above screenshot, you’ll notice that my Halloween icon is cropped too. Another approach would have been to force the height of the picture.

    • Anonymous
    • October 20th, 2009

    I really enjoy the designs you are coming up with in SharePoint, our users are extremely happy. I am having a probelm with the holiday calendar though. I used your updated script, and set up the calculated column, called display. When I set the calendar month view to show display there is nothing in the day. If that makes sense. The picture is there when I hover over the day I know it is in, but the day goes back to blank when i mouse off. The same thing happens in the dispform view. Hover on works and brings up the picture, but nothing there to tell users to hover…Thanks for the help.

    • Pete
    • November 23rd, 2009

    Hi Cristophe,

    Thanks for your great tutorials! Is there a way for when hovering over a normal sized calendar to have the details (i.e. columns) of the appointment show? it’s for use of a training schedule calendar which only shows names by default. Thanks in advance :)

    • Laura
    • December 22nd, 2009

    I added a Content Editor Webpart to my page with the following code

    .td.ms-cal-monthitem A NOBR {display: none;}

    to get rid of the Time on my calendar, but I would like to display 6 items in one day rather than the default 3, and also, REMOVE the space where the time used to be. Any ideas? Many thanks

      • Anonymous
      • January 14th, 2010

      hello- i tried using this in content editor but it does not work am I missing some piece of the code? thanks so much!

      td.ms-cal-monthitem br {display: none;}

    • Eric
    • August 8th, 2011

    Hi, I have a problem with recurring events. Our calendar has events that repeat the same day every week. So to make the DIV ids unique for each week I tried making them a concatenation of title and ID, or Title and Start date, but some of the recurring events copy the ID, Start Date, and all data from the previous occurances in the calendar. (Going to the display item page shows unique ID for each week’s occurence, but this is not carried over to the calendar view for some reason) It doesn’t happen for all recurring events, but I’ve noticed it on the ones after the current week. This makes the pop-ups show in the wrong location. Any idea how to fix this? Thanks for the help.

    • Sorry, I don’t have a solution. Recurring events are stored as a single item, that’s why you get the same ID. I think the unique IDs are only generated at runtime.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 262 other followers

%d bloggers like this: