forked from malsup/cycle2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjquery.cycle2.caption.js
More file actions
34 lines (30 loc) · 1.02 KB
/
Copy pathjquery.cycle2.caption.js
File metadata and controls
34 lines (30 loc) · 1.02 KB
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
30
31
32
33
34
/*! caption plugin for Cycle2; version: BETA-20120910 */
(function($) {
"use strict";
$.extend($.fn.cycle.defaults, {
caption: '> .cycle-caption',
captionTemplate: '{{slideNum}} / {{slideCount}}',
overlay: '> .cycle-overlay',
overlayTemplate: '<div>{{title}}</div><div>{{desc}}</div>'
});
$(document).on( 'cycle-update-view', function( e, opts, slideOpts, currSlide ) {
var el;
$.each(['caption','overlay'], function() {
var name = this, template = slideOpts[name+'Template'];
if( opts[name] && template ) {
el = opts.API.getComponent( name );
el.html( opts.API.tmpl( template, slideOpts, currSlide ) );
}
});
});
$(document).on( 'cycle-destroyed', function( e, opts ) {
var el;
$.each(['caption','overlay'], function() {
var name = this, template = opts[name+'Template'];
if ( opts[name] && template ) {
el = opts.API.getComponent( 'caption' );
el.empty();
}
});
});
})(jQuery);