Sha256: ed131fed51066668fabb2d8d3243bdc603bc2d8e859ccec24479aeba72c09055

Contents?: true

Size: 1.95 KB

Versions: 19

Compression:

Stored size: 1.95 KB

Contents

/*! caption2 plugin for Cycle2;  version: 20130306 */
(function($) {
"use strict";

$.extend($.fn.cycle.defaults, {
    captionFxOut:      'fadeOut',
    captionFxIn:       'fadeIn',
    captionFxSel:      undefined,
    overlayFxOut:      'fadeOut',
    overlayFxIn:       'fadeIn',
    overlayFxSel:      undefined
});    

$(document).on( 'cycle-bootstrap', function(e, opts) {
    opts.container.on( 'cycle-update-view-before', update );
    opts.container.one( 'cycle-update-view-after', init );
});

function update( e, opts, slideOpts, currSlide, isAfter ) {
    if ( opts.captionPlugin !== 'caption2' )
        return;
    $.each(['caption','overlay'], function() {
        var fxBase = this + 'Fx',
            fx = opts[fxBase + 'Out'] || 'hide',
            template = slideOpts[this+'Template'],
            el = opts.API.getComponent( this ),
            sel = opts[fxBase+'Sel'],
            speed = opts.speed,
            animEl;

        if ( opts.sync )
            speed = speed/2;

        animEl = sel ? el.find( sel ) : el;

        if( el.length && template ) {
            if ( fx == 'hide')
                speed = 0;
            animEl[fx]( speed, function() {
                var content = opts.API.tmpl( template, slideOpts, opts, currSlide );
                el.html( content );
                animEl = sel ? el.find( sel ) : el;
                if ( sel )
                    animEl.hide();
                fx = opts[ fxBase + 'In'] || 'show';
                animEl[fx]( speed );
            });
        }
        else {
            el.hide();
        }
    });
}

function init( e, opts, slideOpts, currSlide, isAfter ) {
    if ( opts.captionPlugin !== 'caption2' )
        return;
    $.each(['caption','overlay'], function() {
        var template = slideOpts[this+'Template'],
            el = opts.API.getComponent( this );

        if( el.length && template )
            el.html( opts.API.tmpl( template, slideOpts, opts, currSlide ) );
    });
}

})(jQuery);

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
groundworkcss-0.4.4 app/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.caption2.js
groundworkcss-0.4.3 app/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.caption2.js
groundworkcss-0.4.2 app/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.caption2.js
groundworkcss-0.4.1 app/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.caption2.js
groundworkcss-0.4.0 app/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.caption2.js
groundworkcss-0.3.2 app/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.caption2.js
groundworkcss-0.3.0 vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.caption2.js
groundworkcss-0.2.4 vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.caption2.js
groundworkcss-0.2.3 vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.caption2.js
groundworkcss-0.2.2 vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.caption2.js
groundworkcss-rails-0.2.12 vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.caption2.js
groundworkcss-rails-0.2.11 vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.caption2.js
groundworkcss-rails-0.2.10 vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.caption2.js
groundworkcss-rails-0.2.9 vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.caption2.js
groundworkcss-rails-0.2.8 vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.caption2.js
groundworkcss-rails-0.2.7 vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.caption2.js
groundworkcss-rails-0.2.6 vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.caption2.js
groundworkcss-rails-0.2.5 vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.caption2.js
groundworkcss-rails-0.2.4 vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.caption2.js