init
This commit is contained in:
parent
06f61d8ce8
commit
f301cb744d
2271 changed files with 103162 additions and 0 deletions
44
02-ui/05-widgets/02-widgets-structure/02-slider-widget/solution/lib.js
Executable file
44
02-ui/05-widgets/02-widgets-structure/02-slider-widget/solution/lib.js
Executable file
|
@ -0,0 +1,44 @@
|
|||
|
||||
function fixEvent(e) {
|
||||
e = e || window.event;
|
||||
|
||||
if (!e.target) e.target = e.srcElement;
|
||||
|
||||
if (e.pageX == null && e.clientX != null ) { // если нет pageX..
|
||||
var html = document.documentElement;
|
||||
var body = document.body;
|
||||
|
||||
e.pageX = e.clientX + (html.scrollLeft || body && body.scrollLeft || 0);
|
||||
e.pageX -= html.clientLeft || 0;
|
||||
|
||||
e.pageY = e.clientY + (html.scrollTop || body && body.scrollTop || 0);
|
||||
e.pageY -= html.clientTop || 0;
|
||||
}
|
||||
|
||||
if (!e.which && e.button) {
|
||||
e.which = e.button & 1 ? 1 : ( e.button & 2 ? 3 : ( e.button & 4 ? 2 : 0 ) )
|
||||
}
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
function getCoords(elem) {
|
||||
var box = elem.getBoundingClientRect();
|
||||
|
||||
var body = document.body;
|
||||
var docElem = document.documentElement;
|
||||
|
||||
var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;
|
||||
var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft;
|
||||
|
||||
var clientTop = docElem.clientTop || body.clientTop || 0;
|
||||
var clientLeft = docElem.clientLeft || body.clientLeft || 0;
|
||||
|
||||
var top = box.top + scrollTop - clientTop;
|
||||
var left = box.left + scrollLeft - clientLeft;
|
||||
|
||||
return { top: Math.round(top), left: Math.round(left) };
|
||||
}
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue