防止突出显示外部包装

时间:2014-09-18 13:14:37

标签: javascript jquery mouseevent

如何阻止用户尝试突出显示文本并防止鼠标移出<div>包装?

<div id="wrapper">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. 
</div>

$(function(){
  $('#wrapper').on('mousedown', function(){
    // prevent mouse goes outside the wrapper box, all only highlight inside the wrapper
  });
});

0 个答案:

没有答案