javascript - Select text with mouseup event and dbclick event with call a function -
i jquery select text event , found this example. in illustration mouseup event work dbclick event.
i add together function code homecoming value dbclick doesn't work. jsfiddle
if (!window.james) { james = {}; }
james.selector = {}; james.selector.mouseup = function (e) { var userselection; if (window.getselection) { userselection = window.getselection(); } else if (document.selection) { // should come last; opera! userselection = document.selection.createrange(); } var selectedtext = userselection; if (userselection.text) selectedtext = userselection.text; if (selectedtext != '') { homecoming selectedtext + '------' + e.pagex + '/' + e.pagey; } } $(document).ready(function () { $(document).bind("mouseup", function (e) { alert(james.selector.mouseup(e)) window.getselection().removeallranges(); }); });
i think mean this: http://jsfiddle.net/wblqz/11/
just set settimeout()
allow able dblclick well.
javascript jquery getselection
No comments:
Post a Comment