1
0
Fork 0

Fix positioning when scrolled

This commit is contained in:
Gregory Eremin 2014-07-05 15:16:03 +07:00
parent f8eac322a3
commit 17c0c06e97
2 changed files with 5 additions and 2 deletions

View File

@ -164,14 +164,14 @@
log('Event: '+ e_left +','+ e_top);
// Default positioning
var t_top = s_top + e_top - t_height - 20,
var t_top = e_top - t_height - 20,
t_left = s_left + e_left - t_width / 2;
log('Initial position: '+ t_left +','+ t_top);
if (t_top < 10) {
// Vertical positioning correction
t_top = 10;
t_top = s_top + 10;
if (e_left > w_width / 2) {
t_left = s_left + e_left - t_width - 20;

View File

@ -4,6 +4,7 @@
<title>Playground</title>
<meta charset="utf8">
<style type="text/css">
body { height: 2000px; }
a { position: absolute; }
#l1{ top: 20px; left: 20px; }
@ -12,6 +13,7 @@
#l4{ top: 320px; left: 20px; }
#l5{ top: 420px; left: 20px; }
#l6{ top: 420px; left: 320px; }
#l7{ top: 1000px; left: 320px; }
#r1{ top: 20px; right: 20px; }
#r2{ top: 120px; right: 20px; }
@ -29,6 +31,7 @@
<a id="l4">bad link</a>
<a id="l5" href="../../..">wtf</a>
<a id="l6" href="http://www.aviasales.ru/">aviasales.ru</a>
<a id="l7" href="http://www.aviasales.ru/">aviasales.ru</a>
<a id="r1" href="https://twitter.com/">twitter.com</a>
<a id="r2" href="https://github.com/">github.com</a>