Uber-customsiable video carousel
Overview
This carousel and featured-content rotator excels in two areas: firstly, it serves both video and graphic content, and secondly, it is super-customisable in terms of where the three components of the carousel - namely the slides, the tabs and the 'more info' area - are positioned within it. An XML file controls all behavioral and visual aspects of the carousel, though default settings can be overridden at the point of instantiation.
Example & demo tools
Carousel demo
Demo tools (override default settings)
Instantiation code
Here you can see one permutation of the carousel, but open the video carousel demo tools to see how it can be configured in different ways.
Usage & params
The carousel is instantiated by calling new VideoCarousel(params);, where params is an object of propery name/value pairs including:
configPath (string) - the path to the XML config file containing the settings and slides data that this carousel should read
container (string or node reference) - a jQuery selector string or node reference of the element that should house your carousel
settingsOverrides (object) - an object of property name/value pairings that allows you to override default settings in the XML file, for example if you want the carousel to look or behave differently on a particular page
Here's the instantiation code for the above demo:
1$(function() {
2 new VideoCarousel({
3 configPath: '../inc/script_demos/vid_carousel/config.xml',
4 container: '#vidCarousel1'
5 });
6});
Note the document ready handler - necessary as, otherwise, we couldn't be sure that our #vidCarousel1 element had loaded yet.
XML file - configuring the carousel
The XML file controls all behavioral and visual aspects of your carousel (unless you override any of these settings with the settingsOverrides object - see above). Its structure is as follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
The config file is split into two areas:
Settings
This is where you tell your carousel how to look and behave. The role of the nodes should be largely obvious. A few notes, though:
--- Valid values for settings > tabs > whre are 'top', 'bottom', 'left' or 'right'
--- Valid values for settings > info_area are 'right', 'left' or 'none'
--- Valid values for settings > slides > transition > type are 'slide left', 'slide right', 'slide up' or 'slide down'
--- If you don't want the carousel to auto-rotate, remove the auto_rotate node.
Slides
Include as many slides nodes as you want slides.
Important: whether a slide is graphic or video depends on the presence of a vid_src node.
If it is not present, the slide will simply show the image in slide_src. If it is present, the image in slide_src will form the video's starting image, until the play button is pressed.
Notes
Settings overrides
You can override any setting in the XML config file by passing the XPath of the node as the name of a property in the settingsOverrides object. For example, if on a particular page you want the tabs at the top of the carousel, you'd instantiate like so:
1$(function() {
2 new VideoCarousel({
3 configPath: 'path/to/config.xml',
4 container: '#someElement',
5 settingsOverrides: {
6 'tabs where': 'top'
7 },
8 });
9});
JWPlayer
The carousel uses the free version of the renowned JWPlayer (www.longtailvideo.com/players). The free version includes a faint watermark on your video, in the bottom left corner, which fades once the video starts playing. To remove this, buy the full version of the player.
The JWPlayer is a very versatile player, with a full JavaScript API. Feel free to play around with the carousel script to change the video behavior if you want, e.g. to disallow full-screen mode or control auto-play.
Compatibility
The carousel has been tested and found to work in all recent FF, Opera, Chrome and Safari, and IE 6+.
Comments (5)
Cannings, at 21/01/'11 20:48, said:
Mitya, at 21/01/'11 21:41, said:
George, at 17/05/'12 11:41, said:
Mitya, at 22/05/'12 19:12, said:
robster, at 28/05/'12 06:16, said: