<div class="modal fade modal_position" id="myModal" tabindex="-1" style="min-width:275px;"> <div class="modal-dialog modal-sm"> <div class="modal-content skill-group-content"> <button type="button" class="close skill_group_close" aria-label="Close" data-dismiss="modal" aria-hidden="true"> × </button> <div class="modal-body"> <div class="modal-body-type"> <label class="webchat" for='webchat_topeer'>选择技能组</label> <select class="webchat" id='webchat_topeer'></select> </div> <div class="modal-body-type"> <label class="webchat" for='type_name'>类型名称</label> <input class="webchat" type='text' id='type_name' required> </div> <div class="modal-body-type"> <label>启用咨询类型</label> <input id="webchat_showTypeName" style="width:20px; height:20px;" type="checkbox" value="true" name="webchat_showTypeName" checked="checked"> </div> <button type="button" class="btn-small btn-position ds_do_action" ds_action="config.channel.addSkillGroup"> 确定 </button> </div> </div><!-- /.modal-content --> </div> </div> <script>
$('#myModal').modal().css({ 'margin-top': function () { return ($(this).height() * 1.5); } });
</script>
使用jquery通过在css样式中设置margin-top的值得大小可以改变距离顶端的距离。也可以在style中修改
div.modal.fade.in{top:10%;}修改为任意的大小