I've mentioned before that I'm partial to JQuery, I consider it to be the Jessica Alba of JavaScript.
With all the work that has been done creating awesome JQuery based UI components, it seems like such a shame that us SharePoint developers aren't making more use of them.
So I present to you my first JQuery based web part, the Image Carousel:
Based on JCarousel, this web part presents the contents of a picture library in a carousel that can be scrolled by the navigation buttons.
The web part simply imports the jcarousel.js file, the web part then injects a JavaScript array of the images that reside in the selected picture library along with some javascript that initialises the carousel. The code to find the SharePoint picture library list is trivial:
SPSite site = SPContext.GetContext(HttpContext.Current).Site; SPWeb web = site.OpenWeb(); foreach (SPList list in web.Lists) { if (list.BaseTemplate == SPListTemplateType.PictureLibrary) { //grab the images from this list jsArray.Append(ProcessList(list)); } }
The web part makes use of custom toolpart for the selection of the picture list:
I think this provides a good template and starting point to start putting more of those JQuery plugins to use inside SharePoint
A small screencast of the control in action can be found here.
The end effect is some exceptional functionality for little development effort, which is really what JQuery is all about.
Some of the things that you need to think about when integrating:
The source code can be found here.