-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hover preview window location fixes after prototype 1.71 update.
- Loading branch information
Jiadi Yao
committed
Dec 1, 2015
1 parent
7b54a19
commit 6830797
Showing
1 changed file
with
5 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,32 +1,19 @@ | |||
|
|||
function EPJS_ShowPreview( e, preview_id ) | function EPJS_ShowPreview( e, preview_id ) | ||
{ | { | ||
var box_w = 410; | |||
var box_h = 330; | |||
|
|||
var screen_w = document.viewport.getDimensions().width; | |||
var screen_h = document.viewport.getDimensions().height; | |||
|
|||
var x = document.viewport.getScrollOffsets().left; | |||
var y = document.viewport.getScrollOffsets().top; | |||
|
|||
var box = $(preview_id); | var box = $(preview_id); | ||
|
|
||
box.style.display = 'block'; | box.style.display = 'block'; | ||
box.style.zIndex = 1000; | box.style.zIndex = 1000; | ||
|
|
||
box.style.top = y + screen_h/2 - box_h/2 + "px"; | // Note can find triggering element using findElement | ||
var elt = Event.findElement( e ); | |||
|
|||
|
|
||
var midscreen = x + screen_w/2; | // Element.clonePosition( box, elt, { offsetLeft: (Element.getWidth( elt )) } ); //on the right | ||
var x_pointer = Event.pointerX(e); | Element.clonePosition( box, elt, { setWidth:false, offsetLeft: -(Element.getWidth( box )) } ); //on the left | ||
if( x_pointer < midscreen ) | |||
box.style.left = midscreen + screen_w/4 - box_w/2 + "px"; | |||
else | |||
box.style.left = midscreen - screen_w/4 - box_w/2 + "px"; | |||
} | } | ||
|
|
||
function EPJS_HidePreview( e, preview_id ) | function EPJS_HidePreview( e, preview_id ) | ||
{ | { | ||
$(preview_id).style.display = 'none'; | $(preview_id).style.display = 'none'; | ||
} | } | ||
|