Skip to content
Permalink
Browse files

hover preview window location fixes after prototype 1.71 update.

  • Loading branch information...
jiadiyao committed Dec 1, 2015
1 parent 7b54a19 commit 68307975d5cfcbcd7ec87963b5fc3890d40633f2
Showing with 5 additions and 18 deletions.
  1. +5 −18 lib/static/javascript/auto/50_preview.js
@@ -1,32 +1,19 @@

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);

box.style.display = 'block';
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;
var x_pointer = Event.pointerX(e);
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";
// Element.clonePosition( box, elt, { offsetLeft: (Element.getWidth( elt )) } ); //on the right
Element.clonePosition( box, elt, { setWidth:false, offsetLeft: -(Element.getWidth( box )) } ); //on the left
}

function EPJS_HidePreview( e, preview_id )
{
$(preview_id).style.display = 'none';
}

0 comments on commit 6830797

Please sign in to comment.
You can’t perform that action at this time.