官网地址:http://manos.malihu.gr/jquery-custom-content-scroller/,凑合还能看得懂
http://www.wufangbo.com/mcustomscrollbar/
和
http://www.cnblogs.com/alantao/p/5239262.html
帮助理解。
function getMousePos(event) { //获取鼠标点击时的坐标 /* var e = event || window.event; var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; var scrollY = document.documentElement.scrollTop || document.body.scrollTop; var x = e.pageX || e.clientX + scrollX; var y = e.pageY || e.clientY + scrollY; */ var x =event.clientX ; return { 'x': x };}var mouseX = getMousePos(e).x ; // e -> 鼠标点击事件var mouseX2 =Math.round(mouseX/2)console.log(mouseX2);$("#tree").mCustomScrollbar("scrollTo",mouseX2); // scrollTo -> 设置滚动条滚动到指定的坐标,此处若X、Y都有,则同时滚动。。bug?