diff options
author | Sylvester Johansson <scj@archlinux.us> | 2009-05-28 00:33:08 +0200 |
---|---|---|
committer | Sylvester Johansson <scj@archlinux.us> | 2009-05-28 00:33:08 +0200 |
commit | 2760e44099d43f0c2efbebd10e1ef85b8e20d200 (patch) | |
tree | 09bb7684264d830620e6d60fac8c49e24d8e6699 /examples | |
parent | bf412203b44431ee61936615664b60fca817592a (diff) |
minor fix
Diffstat (limited to 'examples')
-rw-r--r-- | examples/scripts/linkfollow.js | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/examples/scripts/linkfollow.js b/examples/scripts/linkfollow.js index 382d33d..20a756f 100644 --- a/examples/scripts/linkfollow.js +++ b/examples/scripts/linkfollow.js @@ -45,18 +45,14 @@ function Hints(){ up += el.offsetTop; left += el.offsetLeft; } - return [up, left, width, height]; + return {up: up, left: left, width: width, height: height}; } - function elementInViewport(offset) { - var up = offset[0]; - var left = offset[1]; - var width = offset[2]; - var height = offset[3]; - return (up < window.pageYOffset + window.innerHeight && - left < window.pageXOffset + window.innerWidth && - (up + height) > window.pageYOffset && - (left + width) > window.pageXOffset); + function elementInViewport(p) { + return (p.up < window.pageYOffset + window.innerHeight && + p.left < window.pageXOffset + window.innerWidth && + (p.up + p.height) > window.pageYOffset && + (p.left + p.width) > window.pageXOffset); } function isVisible(el) { @@ -95,6 +91,7 @@ function Hints(){ this.position = pos; this.addHint = function (labelNum) { + // TODO: fix uzblclassfirst if(!this.isHinted){ this.node.className += " " + uzblclass; } @@ -104,8 +101,8 @@ function Hints(){ var hintNode = doc.createElement('div'); hintNode.name = uzblid; hintNode.innerText = labelNum; - hintNode.style.left = this.position[1] + 'px'; - hintNode.style.top = this.position[0] + 'px'; + hintNode.style.left = this.position.left + 'px'; + hintNode.style.top = this.position.up + 'px'; hintNode.style.position = "absolute"; doc.body.firstChild.appendChild(hintNode); |