为了账号安全,请及时绑定邮箱和手机立即绑定

jQuery 中 animate height auto 的问题。

jQuery 中 animate height auto 的问题。

卡迪亚兹 2016-03-28 15:22:09
我在做一个竖向的导航栏,当中有二级菜单,当鼠标移入的时候需要展开二级菜单,但是,每一个二级菜单的数目不一样多。所以我需要设置animate height 为 auto,但是好像在jquery中,么有反应。。。之和我在网上找到了别人的决绝方案。只是不明白为什么要这么做。代码如下。var el = $('#first'),     curHeight = el.height(),     autoHeight = el.css('height', 'auto').height(); el.height(curHeight).animate({height: autoHeight}, 1000);别人的是获取id的。我经过自己的改造。。变成如下样子。$(function(){     var el = $('.left li');     el.each(function(){         $(this).mouseover(function(){             curHeight = $(this).height();             autoHeight = $(this).css('height', 'auto').height();             $(this).height(curHeight).stop().animate({height: autoHeight}, 500);         });         $(this).mouseout(function(){             $(this).stop().animate({height:"42px"},500)         })      }) })想请问大神。。。我在网上找的这段代码的意义。。
查看完整描述

目前暂无任何回答

  • 0 回答
  • 0 关注
  • 1945 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信