PageSourceSearch

https://www.9thjudicial.org/views/alerts/js/jquery.cycle2.center.js

js 9thjudicial.org collected 2026-10-08 20:03:22 UTC 1,819 bytes, 65 lines download raw bytes

1/*! center plugin for Cycle2;  version: 20140121 */
2(function($) {
3"use strict";
4
5$.extend($.fn.cycle.defaults, {
6    centerHorz: false,
7    centerVert: false
8});
9
10$(document).on( 'cycle-pre-initialize', function( e, opts ) {
11    if ( !opts.centerHorz && !opts.centerVert )
12        return;
13
14    // throttle resize event
15    var timeout, timeout2;
16
17    $(window).on( 'resize orientationchange load', resize );
18    
19    opts.container.on( 'cycle-destroyed', destroy );
20
21    opts.container.on( 'cycle-initialized cycle-slide-added cycle-slide-removed', function( e, opts, slideOpts, slide ) {
22        resize();
23    });
24
25    adjustActive();
26
27    function resize() {
28        clearTimeout( timeout );
29        timeout = setTimeout( adjustActive, 50 );
30    }
31
32    function destroy( e, opts ) {
33        clearTimeout( timeout );
34        clearTimeout( timeout2 );
35        $( window ).off( 'resize orientationchange', resize );
36    }
37
38    function adjustAll() {
39        opts.slides.each( adjustSlide ); 
40    }
41
42    function adjustActive() {
43        /*jshint validthis: true */
44        adjustSlide.apply( opts.container.find( '.' + opts.slideActiveClass ) );
45        clearTimeout( timeout2 );
46        timeout2 = setTimeout( adjustAll, 50 );
47    }
48
49    function adjustSlide() {
50        /*jshint validthis: true */
51        var slide = $(this);
52        var contW = opts.container.width();
53        var contH = opts.container.height();
54        var w = slide.outerWidth();
55        var h = slide.outerHeight();
56        if (w) {
57            if (opts.centerHorz && w <= contW)
58                slide.css( 'marginLeft', (contW - w) / 2 );
59            if (opts.centerVert && h <= contH)
60                slide.css( 'marginTop', (contH - h) / 2 );
61        }
62    }
63});
64
65})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.