fixed center image
This commit is contained in:
parent
25346dc966
commit
e06f538690
8 changed files with 35 additions and 38 deletions
8
js/jquery.imagefill.min.js
vendored
Normal file
8
js/jquery.imagefill.min.js
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* jQuery Image Fill
|
||||
* http://pioul.fr/jquery-imagefill
|
||||
*
|
||||
* Copyright 2013, Philippe Masset
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses
|
||||
*/
|
||||
(function(a){a.fn.imagefill=function(b){b=a.extend({},{container:null,fadingDuration:500},b);var c=a(this);return c.each(function(){var c=a(this),d={options:b,image:c,container:b.container?c.closest(b.container):c.parent(),init:function(){this.container.css("overflow","hidden"),this.image.css("position","relative")},show:function(){this.options.fadingDuration?this.image.fadeIn(this.options.fadingDuration):this.image.show()},fillContainer:function(){var a=this.container.width(),b=this.container.height(),c=this.image.width(),d=this.image.height(),e=c/a,f=d/b;if(f>e){var g={width:a,height:d/e};g.top=-(g.height-b)/2}else{var g={width:c/f,height:b};g.left=-(g.width-a)/2}this.image.css(g).trigger("fillsContainer",[g])}};d.image.data("imagefill",d),d.container.length&&(d.init(),d.image[0].complete?setTimeout(a.proxy(function(){this.fillContainer()},d),0):(d.image.hide(),d.image.bind("load",function(){var b=a(this).data("imagefill");b.show(),b.fillContainer()})))}),c}})(jQuery);
|
||||
Loading…
Add table
Add a link
Reference in a new issue