imgCentering 是一款可以让图片在div居中和实现弹出层的图片jQuery插件,可在一组图片中查看前一张和后一张进行切换的图片相册查看效果,且具有不错的动画效果。
使用教程:
1、引用文件:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script> <script src="js/imgcentering.js"></script>2、HTML代码结构:
<a href="#" class="container"><img src="sample1.jpg" alt="" /></a>3、配置插件:
$(document).ready(function(){   
	$(".container img").imgCentering();
});
插件参数:
| Name | Type | Default | Description | 
|---|---|---|---|
| forceWidth | Boolean | false | Force image width same to it’s container’s width. | 
| forceHeight | Boolean | false | Force image height same to it’s container’s height. | 
| forceSmart | Boolean | false | Auto detect which option (forceWidth or forceHeight) is better, hence leave no empty space. | 
| bgColor | Color Hex | ”inherit” | Background color for empty space. | 
插件主页:http://www.inwebson.com/jquery/imgcentering-js-centering-images-plugin/

