Skip to content

Commit

Permalink
hover preview window location fixes after prototype 1.71 update.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiadi Yao committed Dec 1, 2015
1 parent 7b54a19 commit 6830797
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions lib/static/javascript/auto/50_preview.js
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';
} }

0 comments on commit 6830797

Please sign in to comment.