PageSourceSearch

https://leksendesign.com/wp-content/plugins/ultimate-post-thumbnails/js/makeslider.js

js leksendesign.com collected 2026-10-02 17:17:39 UTC 3,414 bytes, 98 lines download raw bytes

1/* Create thumbnail link
2 *
3 * HTML code change is involved here, in which case, if Isotope loaded after
4 * this script, it won't work, reason unknown
5 *
6 * So to say, we need to ensure this script loaded after Isotope.
7 */
8(function($) {
9    "use strict";
10
11    $.fn.upt_makeslider = function() {
12        /*
13         * Isotope/Masonry requires grid item thumbnail visible to determin its position, but
14         * Flexslider require thumbnail hidden until it finishes loading
15         *
16         * Flexslider also requires window.load, here is a workaround to use it with document.ready
17         * http://stackoverflow.com/questions/16335050/flexslider-2-how-to-load-with-document-ready-function
18         *
19         * So, make thumbnail visiable and then hide it before loading flexslider
20         */
21        // $('.upt-slides .upt-item:first-child', this).css('display', 'none');
22
23        var args;
24        if (typeof $(this).attr('data-slider') !== 'undefined') {
25            args = $(this).data('slider');
26        } else
27            args = '';
28
29        // If an ajax loading GIF exists, remove it when all images loaded
30        $(this).css('background-image', 'none');
31
32        var container = $(this).parent();
33
34        if (container.hasClass('upt-toggle')) {
35            args['animation'] = 'fade';
36            args['slideshow'] = false;
37            // $('.upt-slides .upt-item:first-child', this).css('display', 'block');
38
39        } else if (args['controlNav'] && args['controlNav'] == 'thumbnails') {
40            // Add image class to the first thumbnail of control nav  
41            args['start'] = function(slider) {
42                slider.parent().find('.flex-control-thumbs img').addClass(slider.find('img:first').attr('class'));
43            };
44        } else if (args['slideshow'] && args['slideshow'] == 'hover') {
45            // Play on hover
46            args['slideshow'] = false;
47            args['start'] = function(slider) {
48                // $('.preview').removeClass('loading');
49                slider.pause();
50                slider.manualPause = true;
51                slider.mouseenter(function() {
52                    slider.manualPause = false;
53                    slider.flexslider(slider.getTarget("next"));
54                    slider.play();
55                });
56                slider.mouseleave(function() {
57                    slider.manualPause = true;
58                    slider.pause();
59                });
60            };
61        }
62
63        $(this).flexslider(args).flexsliderManualDirectionControls({
64            previousElementSelector: ".upt-previous",
65            nextElementSelector: ".upt-next"
66                // disabledStateClassName: "alternativeDisabledClass"
67        });
68    };
69
70    $(window).load(function() {
71
72        var sliders = $('.upt-thumb-slider');
73        if (sliders.length)
74            sliders.upt_makeslider();
75
76    });
77
78    $(document).ready(function() {
79
80        /**
81         * Gallery
82         *
83         * @since UPT 2.3
84         */
85        $('.upt-gallery').each(function() {
86            var grid = $(this);
87            grid.imagesLoaded().done(function() {
88                var grid_args = grid.data('grid');
89                if (grid_args) {
90                    grid.isotope(grid_args);
91                }
92            });
93        });
94
95    });
96
97
98})(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.