$('#centre li:has(ul)').children(':first-child').click( function(e){
// element vars
var el = $(this).parent().children('ul').first();
var isOpen = $(this).parent().hasClass('mtree-open');
alert(isOpen);
console.log($(this).parent().html());
// force auto height of element so actual height can be extracted 力汽车元素,所以实际高度的高度可以提取
el.css({'height': 'auto'});
// Velocity.js animate element Velocity.js 动画元素
if($.Velocity) {
el.velocity('stop').velocity({
// translateZ: 0, // optional hardware-acceleration is automatic on mobile 可选硬件加速的自动移动
height: isOpen ? [0, el.outerHeight()] : [el.outerHeight(), 0]
},{
queue: false,
duration: duration,
easing: easing,
display: isOpen ? 'none' : 'block',
begin: setNodeClass($(this).parent(), isOpen),
complete: function(){
if(!isOpen) $(this).css('height', 'auto');
}
});
//jQuery fallback animate element jQuery后备动画元素
} else {
setNodeClass($(this).parent(), isOpen);
el.slideToggle(duration);
}
// We can't have nodes as links unfortunately 不幸的是我们不能有节点链接
//e.preventDefault();
});