我怎样才能缩短它以使其全部适合一个功能。我有一个工作图像库,当单击具有类 a 的图像时,类 bigimg 中的图像更改为选定的图像。我可能已经做了很长的更改图像的工作,但最多只有十几个。
顺便说一句,我将托管我的图片,这些图片仅用于我的测试
HTML/jQuery
<div id="galleryholder">
<div id="largeimg" class="center">
<img class="bigimg" src="http://1.bp.blogspot.com/-BNkayp7vphQ/UEmx3WTwe1I/AAAAAAAAELg/eHu4hWtoXbk/s1600/desktop-wallpaper-29.jpg">
</div>
<div id="reel">
<a href=""><img class="a" src="http://wallpaperstate.org/wp-content/gallery/ca_home/hd-wallpaper-30.jpg"></a>
<a href="#"><img class="b" src="http://1.bp.blogspot.com/-BNkayp7vphQ/UEmx3WTwe1I/AAAAAAAAELg/eHu4hWtoXbk/s1600/desktop-wallpaper-29.jpg"></a>
<a href="#"><img class="c" src="http://1.bp.blogspot.com/-BNkayp7vphQ/UEmx3WTwe1I/AAAAAAAAELg/eHu4hWtoXbk/s1600/desktop-wallpaper-29.jpg"></a>
</div>
<script>
$(function() {
$('.a').click(function(){
$(".bigimg").attr('src',"http://wallpaperstate.org/wp-content/gallery/ca_home/hd-wallpaper-30.jpg");
return false;
});
});
$(function() {
$('.b').click(function(){
$(".bigimg").attr('src',"http://1.bp.blogspot.com/-BNkayp7vphQ/UEmx3WTwe1I/AAAAAAAAELg/eHu4hWtoXbk/s1600/desktop-wallpaper-29.jpg");
return false;
});
});
</script>
</div>