Permalink
Browse files

Added tracking of X Scroll Offsets. In case the page is scrolled hori…

…zontally the modalbox will always appear and remain on screen as well.
  • Loading branch information...
1 parent 73112ff commit 00bb1a472bc46297a4f83340dc57fdf9c6887f76 Alexey Kulikov committed Aug 10, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 modalbox.js
View
@@ -85,9 +85,15 @@ Modalbox.Methods = {
$('MB_window').setStyle({top:scrollOffsets[1] + 'px'});
}
+ //apparently the X offset may also come in question
+ if (scrollOffsets[0] > 0) {
+ $('MB_window').setStyle({left:scrollOffsets[0] + 'px'});
+ }
+
Event.observe(window, 'scroll', function() {
scrollOffsets = document.viewport.getScrollOffsets();
$('MB_window').setStyle({top:scrollOffsets[1] + 'px'});
+ $('MB_window').setStyle({left:scrollOffsets[0] + 'px'});
});
// Initial scrolling position of the window. To be used for remove scrolling effect during ModalBox appearing

0 comments on commit 00bb1a4

Please sign in to comment.