PageSourceSearch

https://www.biodiversidad.gob.ec/wp-content/themes/Sitio-32/library/js/fillsize.js?ver=4.7.6

js biodiversidad.gob.ec collected 2026-09-25 04:39:12 UTC 2,278 bytes, 74 lines download raw bytes

1/*! fillsize (c) 2012-2013, Rico Sta. Cruz. MIT License.
2 *  http://github.com/rstacruz/jquery-stuff/tree/master/fillsize */
3
4// Makes an element fill up its container.
5//
6//     $(".container").fillsize("> img");
7//
8// This binds a listener on window resizing to automatically scale down the
9// child (`> img` in this example) just so that enough of it will be visible in
10// the viewport of the container.
11//
12// This assumes that the container has `position: relative` (or any 'position',
13// really), and `overflow: hidden`.
14
15(function($) {
16  $.fn.fillsize = function(selector) {
17    var $parent = this;
18    var $img;
19
20    function resize() {
21      if (!$img) $img = $parent.find(selector);
22
23      $img.each(function() {
24        if (!this.complete) return;
25        var $img = $(this);
26
27        var parent = { height: $parent.innerHeight(), width: $parent.innerWidth() };
28        var imageRatio     = $img.width() / $img.height();
29        var containerRatio = parent.width / parent.height;
30
31        var css = {
32          position: 'absolute',
33          left: 0, top: 0, right: 'auto', bottom: 'auto'
34        };
35
36        // If image is wider than the container
37     /**   if (imageRatio > containerRatio) {
38          css.left = Math.round((parent.width - imageRatio * parent.height) / 2) + 'px';
39          css.width = 'auto';
40          css.height = '100%';
41        }
42
43        // If the container is wider than the image
44        else {
45          css.top = Math.round((parent.height - (parent.width / $img.width() * $img.height())) / 2) + 'px';
46          css.height = 'auto';
47          css.width = '100%';
48        }
49
50        $img.css(css); **/
51      });
52    }
53
54    // Make it happen on window resize.
55    $(window).resize(resize);
56
57    // Allow manual invocation by doing `.trigger('fillsize')` on the container.
58    $(document).on('fillsize', $parent.selector, resize);
59
60    // Resize on first load (or immediately if called after).
61    $(function() {
62      // If the child is an image, fill it up when image's real dimensions are
63      // first determined. Needs to be .bind() because the load event will
64      // bubble up.
65      $(selector, $parent).bind('load', function() {
66        setTimeout(resize, 25);
67      });
68
69      resize();
70    });
71
72    return this;
73  };
74})(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.