PageSourceSearch

https://honeys.co.jp/cms/hny_js/jquery-thumbfit.js

js honeys.co.jp collected 2026-10-02 17:28:03 UTC 2,263 bytes, 87 lines download raw bytes

1/*
2Thumbnail Fit Plugin - v1.0
3@author Yu Ishihara
4@github https://github.com/is8r/jquery-thumbfit
5@version 1.0
6@howto
7;(function(jQuery) {
8  $(function(){
9    $('li', '.js-thumbs').thumbfit({
10      width: 200,
11      height: 100
12    });
13  });
14})(jQuery);
15*/
16
17;(function(jQuery) {
18    
19  var pluginName = 'thumbfit';
20  
21  $[pluginName] = function(element, options) {
22
23      //----------------------------------------------------------------------
24      //data
25      
26      //data for plugin
27      var defaults = {
28          pluginName: pluginName,
29          width: 100,
30          height: 100
31      }
32      var plugin = this;
33      plugin.settings = {}
34      var $element = $(element);
35      var element = element;
36      
37      //----------------------------------------------------------------------
38      //method
39      
40      plugin.init = function() {
41          plugin.settings = $.extend({}, defaults, options);
42          plugin.items = options.items;
43          
44          //
45          plugin.initPlugin();
46      }
47      
48      //----------------------------------------------------------------------
49      
50      plugin.initPlugin = function(e) {
51        $element.each(function(i, el) {
52          $(el).addClass('background-fix');
53          $(el).css({
54            'background-image': 'url('+$('img', el).attr('src')+')',
55            'width': plugin.settings.width,
56            'height': plugin.settings.height,
57            'background-position': 'center center',
58            'background-repeat': 'no-repeat',
59            'background-size': 'cover'
60          });
61          $('img', el).css({
62            'opacity': 0
63          });
64        });
65      }
66      
67      //----------------------------------------------------------------------
68      
69      plugin.init();
70  }
71  
72  //----------------------------------------------------------------------
73  
74  $.fn[pluginName] = function(options) {
75      if(!options) options = {};
76      options.items = [];
77      return this.each(function(i) {
78          options.id = i;
79          options.items.push($(this));
80          if (undefined == $(this).data(pluginName)) {
81              var plugin = new $[pluginName](this, options);
82              $(this).data(pluginName, plugin);
83          }
84      });
85  }
86    
87})(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.