今天在做网站的时候,要做一个滑动的下拉效果
我的代码如下
html:
服务项目
js:
/**悬浮下拉**/
$(function(){
$("div#service_con li").hover(function(){
$(this).find("div.slider").stop(true,false).animate({
height:174,
},300).find("div.text_con").stop(false,true).fadeIn(300);
},function(){
$(this).find("div.slider").stop(true,false).animate({
height:0,
},300).find("div.text_con").stop(false,true).fadeOut(300);
});
});
在其他浏览器测试都没有问题,但是在ie中测试死活没有效果,经调试说是“缺少标识符,或数字”,提示的是第5行和第9行,但是这两行并没有什么问题,只是有一个逗号,
抱着试一下的态度,去掉逗号,握草,居然可以了;
修改后js代码:
/**悬浮下拉**/
$(function(){
$("div#service_con li").hover(function(){
$(this).find("div.slider").stop(true,false).animate({
height:174
},300).find("div.text_con").stop(false,true).fadeIn(300);
},function(){
$(this).find("div.slider").stop(true,false).animate({
height:0
},300).find("div.text_con").stop(false,true).fadeOut(300);
});
});
原来在ie中使用animate函数时,最后一个属性不能加逗号;虽然不是什么大问题,但还是分享出来,希望能帮到学习jquery的新手朋友!