jquery 全屏幻燈片 fullsizable GTX增強版 不拉伸圖片

if (image.ratio == null) {
image.ratio = (image.naturalHeight / image.naturalWidth).toFixed(2);
}
if ($(window).height() / image.ratio > $(window).width()) {
$(image).width($(window).width());
$(image).height($(window).width() * image.ratio);
return $(image).css('margin-top', ($(window).height() - $(image).height()) / 2);
} else {
//都執行了這塊代碼 var max = $("#jquery-fullsizable").height();
var imgh = $(image).context.height;
var mtop = 0;
if (imgh >= max) {
mtop = 0;
} else {
mtop = parseInt((max - imgh) / 2);css

}  
	console.log(mtop);  
	// $(image).height($(window).height());  
	//  $(image).width($(image).width);  
	return $(image).css('margin-top', mtop);  
}

官方地址http://plugins.jquery.com/fullsizable/ githubhttps://github.com/MSchmidt/jquery-fullsizablejquery

相關文章
相關標籤/搜索