点击input框时,在input框下边展示一个div


    
//此处在div中的ul是一个ztree树
var html='<div id="'+btnName+'DropDown" style="display: none;position:absolute; height:200px; min-width:150px; background-color:white;border:1px solid;overflow-y:auto;overflow-x:auto;z-index: 999999">'+ '<ul id="'+btnName+'Tree" class="ztree"></ul>'+ '</div>' $("body").append(html); //站点文本框点击事件 $btn.click(function () { var stationObj = $btn; var stationOffset = $btn.offset(); $("#"+btnName+"DropDown").css({left:stationOffset.left + "px", top:stationOffset.top + stationObj.outerHeight() + "px"}).slideDown("fast"); });   //站点选择失去焦点 $("body").bind("mousedown", function(event){ if (!(event.target.id == btnName || event.target.id == btnName+"DropDown" || $(event.target).parents("#"+btnName+"DropDown").length>0)) { $("#"+btnName+"DropDown").fadeOut("fast"); } } );

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM