PageSourceSearch

https://www.favolefantasia.com/wp-content/themes/WpAdvNewspaper13/includes/js/jCarouselLite.js?ver=3.7.38

js favolefantasia.com collected 2026-10-02 13:33:57 UTC 5,401 bytes, 140 lines download raw bytes

1(function($) {                                          // Compliant with jquery.noConflict()
2$.fn.jCarouselLite = function(o) {
3    o = $.extend({
4        btnPrev: null,
5        btnNext: null,
6        btnGo: null,
7        mouseWheel: false,
8        auto: null,
9
10        speed: 200,
11        easing: null,
12
13        vertical: false,
14        circular: true,
15        visible: 3,
16        start: 0,
17        scroll: 1,
18
19        beforeStart: null,
20        afterEnd: null
21    }, o || {});
22
23    return this.each(function() {                           // Returns the element collection. Chainable.
24
25        var running = false, animCss=o.vertical?"top":"left", sizeCss=o.vertical?"height":"width";
26        var div = $(this), ul = $("ul:first", div), tLi = $(".car", ul), tl = tLi.size(), v = o.visible;
27
28        if(o.circular) {
29            ul.prepend(tLi.slice(tl-v-1+1).clone())
30              .append(tLi.slice(0,v).clone());
31            o.start += v;
32        }
33
34        var li = $(".car", ul), itemLength = li.size(), curr = o.start;
35        div.css("visibility", "visible");
36
37        li.css({overflow: "hidden", float: o.vertical ? "none" : "left"});
38        ul.css({ padding: "0", position: "relative", "list-style-type": "none", "z-index": "1"});
39        //div.css({overflow: "hidden", position: "relative", "z-index": "2", left: "29px"});
40		div.css({overflow: "hidden", "z-index": "2", left: "29px"});
41
42        var liSize = o.vertical ? height(li) : width(li);   // Full li size(incl margin)-Used for animation
43        var ulSize = liSize * itemLength;                   // size of full ul(total length, not just for the visible items)
44        var divSize = liSize * v;                           // size of entire div(total length for just the visible items)
45
46        li.css({width: li.width()});
47        ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize));
48
49        div.css(sizeCss, divSize+"px");
49                     // Width of the DIV. length of visible images
50
51        if(o.btnPrev)
52            $(o.btnPrev).click(function() {
53                return go(curr-o.scroll);
54            });
55
56        if(o.btnNext)
57            $(o.btnNext).click(function() {
58                return go(curr+o.scroll);
59            });
60
61        if(o.btnGo)
62            $.each(o.btnGo, function(i, val) {
63                $(val).click(function() {
64                    return go(o.circular ? o.visible+i : i);
65                });
66            });
67
68        if(o.mouseWheel && div.mousewheel)
69            div.mousewheel(function(e, d) {
70                return d>0 ? go(curr-o.scroll) : go(curr+o.scroll);
71            });
72
73        if(o.auto)
74            setInterval(function() {
75                go(curr+o.scroll);
76            }, o.auto+o.speed);
77
78        function vis() {
79            return li.slice(curr).slice(0,v);
80        };
81
82        function go(to) {
83            if(!running) {
84
85                if(o.beforeStart)
86                    o.beforeStart.call(this, vis());
87
88                if(o.circular) {            // If circular we are in first or last, then goto the other end
89                    if(to<=o.start-v-1) {           // If first, then goto last
90                        ul.css(animCss, -((itemLength-(v*2))*liSize)+"px");
91                        // If "scroll" > 1, then the "to" might not be equal to the condition; it can be lesser depending on the number of elements.
92                        curr = to==o.start-v-1 ? itemLength-(v*2)-1 : itemLength-(v*2)-o.scroll;
93                    } else if(to>=itemLength-v+1) { // If last, then goto first
94                        ul.css(animCss, -( (v) * liSize ) + "px" );
95                        // If "scroll" > 1, then the "to" might not be equal to the condition; it can be greater depending on the number of elements.
96                        curr = to==itemLength-v+1 ? v+1 : v+o.scroll;
97                    } else curr = to;
98                } else {                    // If non-circular and to points to first or last, we just return.
99                    if(to<0 || to>itemLength-v) return;
100                    else curr = to;
101                }                           // If neither overrides it, the curr will still be "to" and we can proceed.
102
103                running = true;
104
105                ul.animate(
106                    animCss == "left" ? { left: -(curr*liSize) } : { top: -(curr*liSize) } , o.speed, o.easing,
107                    function() {
108                        if(o.afterEnd)
109                            o.afterEnd.call(this, vis());
110                        running = false;
111                    }
112                );
113                // Disable buttons when the carousel reaches the last/first, and enable when not
114                if(!o.circular) {
115                    $(o.btnPrev + "," + o.btnNext).removeClass("disabled");
116                    $( (curr-o.scroll<0 && o.btnPrev)
117                        ||
118                       (curr+o.scroll > itemLength-v && o.btnNext)
119                        ||
120                       []
121                     ).addClass("disabled");
122                }
123
124            }
125            return false;
126        };
127    });
128};
129
130function css(el, prop) {
131    return parseInt($.css(el[0], prop)) || 0;
132};
133function width(el) {
134    return  el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight');
135};
136function height(el) {
137    return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom');
138};
139
140})(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.