单击事件到自动事件图像在Jquery中更改

时间:2012-06-05 09:38:56

标签: javascript jquery html css

这里我的代码..当我点击图片的缩略图时,图片会显示确定.. 现在我需要自动更改图像..不是点击事件, 所以帮我改变这个javascript

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
         $(function() {
            $(".image").click(function() {
            var image = $(this).attr("rel");
            $('#img').hide();
            $('#img').fadeIn('slow');
            $('#img').html('<img src="' + image + '" class="img"/>');
            $('#img').
            return false;
                });
        });
</script>

<style>
.img{
border:4px #666 solid;
width:410px; height:350px;
}

.thumb{
float:left; 
height:60px;
width:80px;
padding:10px;
}
</style>

<div  id="img" ><img src="../content/ohoopee1.jpg" border="0" style="width:410px; height:350px;border:4px #666 solid;" /></div>

                    <a href="#" rel="../content/ohoopee1.jpg" class="image"><img src="../content/ohoopee1.jpg" class="thumb" border="0"/></a>
                    <a href="#" rel="../content/ohoopee2.jpg" class="image"><img src="../content/ohoopee2.jpg" class="thumb" border="0"/></a>
                    <a href="#" rel="../content/ohoopee3.jpg" class="image"><img src="../content/ohoopee3.jpg" class="thumb" border="0"/></a>
                    <a href="#" rel="../content/ohoopee4.jpg" class="image"><img src="../content/ohoopee4.jpg" class="thumb" border="0"/></a>

帮助......

1 个答案:

答案 0 :(得分:0)