function throttle(fun, delay) {
let last,
timer;
return function () {
let self = this,
args = arguments,
now = +new Date();
if (last && now < last + delay) {
clearTimeout(timer);
timer = setTimeout(function () {
last = now;
fun.apply(self, args);
}, delay);
} else {
last = now;
fun.apply(self, args);
}
}
}
//类型选择框跟随鼠标移动 节流
$('.right-box').on('mousemove',throttle(function (e) {
if ($('.select-box-tools').length>0){
$('.select-box-tools').css({
left: e.pageX,
top: e.pageY,
})
}
},100));