显示缩略图

本文由清尘发表于2013-10-20 15:28最后修改于2015-10-20属于javascript分类
function bindThumbsEvent(){
	$('#thumbs a').each(function(){
		$('#thumbs a')[i].onclick = (function(i){
			return function(){
				var url = $($("#thumbs img")[i]).attr("src");
				$(".big_pic").empty();
				showBigImg(url);
			}
		})(i);
	})
}

function showBigImg(url){
	var a = url.lastIndexOf("/t");
	b = url.substring(0,a);
	c = url.substring(a+2);
	var temp_str;
	temp_str = "<img src='"+b+"/"+c+"' alt='"+c+"' />";
	$(temp_str).appendTo(".big_pic");
}