1.如下图,在拖动的div上绑定鼠标事件,id=eagleMapContainer是拖动时需要改变高度的div
2.下面是方法
if (!this.open_status) {
return
}
var targetDiv = document.getElementById('eagleMapContainer')
var targetDivHeight = targetDiv.offsetHeight
var startY = e.clientY
document.onmousemove = function(e) {
e.preventDefault()
var distY = Math.abs(e.clientY - startY)
if (e.clientY < startY) {
targetDiv.style.height = targetDivHeight + distY + 'px'
}
if (e.clientY > startY) {
targetDiv.style.height = (targetDivHeight - distY) + 'px'
}
if (parseInt(targetDiv.style.height) >= 700) {
targetDiv.style.height = 700 + 'px'
}
}
document.onmouseup = function() {
document.onmousemove = null
}
}