Reputation: 1
I am working on a web-Based Kalendar Application (multi-user). The Application is nearly ready, but one thing is not so good. I want to give the User the chance, to mark several times at one time. That's why, i made a mousedown-function, on every field, and a mouseup-function as well. That way, I get the first marked field, and the last. All fields in the middle can be calculated by the id!
Now the problem: While I am moving the mouse, the browser marks the text. I want another mouse behavior. I want the mouse to draw a rectangle, so that the user sees, where he started, an so that no text within the document gets marked! This is very important. Do you know, how to solve the problem? I already deactivated the right-Click Menu, an set my own menu, but this is to hard for me :(. I have already searched the web with google, but actually I do not really know, which keywords could help here.
PS: I am using jQuery, maybe it could help in this situation.
Upvotes: 0
Views: 216
Reputation: 1
OK, i found out, what was wrong. Your Code is for IE only. I am using Firefox, and I optimize my Application to Firefox! Well now, i managed disabling selecting text, with that function:
$(document).ready(function() {
$(document)[0].oncontextmenu = function() {return false;}
$('#id').mousedown(function(event) {
checkClk(event);
return false;
});
});
The function checkClk(event) controls the Clicking-Behavior. Beside I managed to make the mouse-Pointer standart-Pointer with css:
body {
cursor: default;
}
All I need is now, to figure out, how I can draw a rectangle, when I move the mous, holding the left Button clicked. I want the Application look like the operating-System. If you click and hold the mouse down, there is an Rectangle (like this: http://img21.imageshack.us/i/markiert.png/). Does anyone know, wheather this is possible without making a div, which size depends on the Mouseposition?
Upvotes: 0
Reputation: 2567
Here's a script to disable text selection:
http://www.dynamicdrive.com/dynamicindex9/noselect.htm
If you have jQuery, you can use bind like:
$('#demo').bind('selectstart',function(e) {
e.preventDefault();
});
Here's a JSFiddle:
Upvotes: 4