特效描述:jQuer y鼠标点击 收缩展开 图片菜单。jQuery鼠标点击收缩展开图片菜单
代码结构
1. 引入JS
2. HTML代码
点击展开
$('.top span').click(function(){
var spanhtml = $('.top span').html();
if(spanhtml=="点击展开"){
$('.top span').html('点击收起');
$('.top').animate({
width:'100%',
height:'200px'
},200);
//图片展开
$('.top .imgbox img').animate({
width:'188px',
height:'105px'
},200);
}else{
$('.top span').html('点击展开');
$('.top').animate({
width:'1002px',
height:'50px'
},200,function(){
//图片缩小
$('.top .imgbox img').animate({
width:'94px',
height:'53px'
},200);
});
}
});