点击下拉,点击自己或者其他地方收起
//点击出现下拉框
$(".select").click(function(event){
var type = $(this).attr("data-type");
click_index = $(this).index();
if(type=="0"){
$(this).find("ul").slideDown();//下拉
$(this).attr("data-type","1");
}else{
$(this).find("ul").slideUp();//收起
$(this).attr("data-type","0");
}
})
// 点其他地方下拉框隐藏
$(document).mouseup(function (e) {
var _con = $('.select ul');
if (!_con.is(e.target) && _con.has(e.target).length === 0) {
$('.select ul').slideUp();
$(".select").attr("data-type","0");
}
})