资源说明:A jQuery plugin to fire off a custom/special event everytime a text is selected in the webpage.
Description
This plugin will let you bind a custom (special) event to your document, namely 'textselect'. What this does is triggering an event when text is selected in the document, and returning the selected text plus the nearest element containing all the text. What this means is that if a text selection spans over several elements, e.g. <strong>, <strike> etc, it'll select the parent, as that DOM element is containing all the text that has been selected. Please note, as of now, it doesn't support multi text selections in Webkit/Firefox.Usage
$(document).bind('textselect', function (evt, string, element) { if (string != "") alert('Selected text (' + element.tagName + '): ' + string); });
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。