Guest

jQuery lightBox plugin patch for larger pages

By: a guest on Mar 4th, 2010  |  syntax: Diff  |  size: 3.69 KB  |  hits: 629  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. This patch fix the position and size of the overlay and the position of the main lightBox window when using large pages.
  2. Created by: Rodrigo Chacon
  3.  
  4.  
  5. --- jquery.lightbox-0.5.js.old  2010-03-03 03:53:02.000000000 -0300
  6. +++ jquery.lightbox-0.5.js      2010-03-04 02:04:31.000000000 -0300
  7.  -133,7 +133,7 @@
  8.                                 backgroundColor:        settings.overlayBgColor,
  9.                                 opacity:                        settings.overlayOpacity,
  10.                                 width:                          arrPageSizes[0],
  11. -                               height:                         arrPageSizes[1]
  12. +                               height:                         arrPageSizes[3]
  13.                         }).fadeIn();
  14.                         // Get page scroll
  15.                         var arrPageScroll = ___getPageScroll();
  16.  -388,73 +388,26 @@
  17.                         $('embed, object, select').css({ 'visibility' : 'visible' });
  18.                 }
  19.                 /**
  20. -                / THIRD FUNCTION
  21. -                * getPageSize() by quirksmode.com
  22. +                * by Rodrigo Chacon
  23.                  *
  24.                  * @return Array Return an array with page width, height and window width, height
  25.                  */
  26.                 function ___getPageSize() {
  27. -                       var xScroll, yScroll;
  28. -                       if (window.innerHeight && window.scrollMaxY) { 
  29. -                               xScroll = window.innerWidth + window.scrollMaxX;
  30. -                               yScroll = window.innerHeight + window.scrollMaxY;
  31. -                       } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
  32. -                               xScroll = document.body.scrollWidth;
  33. -                               yScroll = document.body.scrollHeight;
  34. -                       } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
  35. -                               xScroll = document.body.offsetWidth;
  36. -                               yScroll = document.body.offsetHeight;
  37. -                       }
  38. -                       var windowWidth, windowHeight;
  39. -                       if (self.innerHeight) { // all except Explorer
  40. -                               if(document.documentElement.clientWidth){
  41. -                                       windowWidth = document.documentElement.clientWidth;
  42. -                               } else {
  43. -                                       windowWidth = self.innerWidth;
  44. -                               }
  45. -                               windowHeight = self.innerHeight;
  46. -                       } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
  47. -                               windowWidth = document.documentElement.clientWidth;
  48. -                               windowHeight = document.documentElement.clientHeight;
  49. -                       } else if (document.body) { // other Explorers
  50. -                               windowWidth = document.body.clientWidth;
  51. -                               windowHeight = document.body.clientHeight;
  52. -                       }      
  53. -                       // for small pages with total height less then height of the viewport
  54. -                       if(yScroll < windowHeight){
  55. -                               pageHeight = windowHeight;
  56. -                       } else {
  57. -                               pageHeight = yScroll;
  58. -                       }
  59. -                       // for small pages with total width less then width of the viewport
  60. -                       if(xScroll < windowWidth){     
  61. -                               pageWidth = xScroll;           
  62. -                       } else {
  63. -                               pageWidth = windowWidth;
  64. -                       }
  65. -                       arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
  66. +                       arrayPageSize = new Array();
  67. +                       arrayPageSize[0] = $("body").width();
  68. +                       arrayPageSize[1] = $("body").height();
  69. +                       arrayPageSize[2] = $(window).width();
  70. +                       arrayPageSize[3] = $(window).height();
  71.                         return arrayPageSize;
  72.                 };
  73.                 /**
  74. -                / THIRD FUNCTION
  75. -                * getPageScroll() by quirksmode.com
  76. +                * by Rodrigo Chacon
  77.                  *
  78.                  * @return Array Return an array with x,y page scroll values.
  79.                  */
  80.                 function ___getPageScroll() {
  81. -                       var xScroll, yScroll;
  82. -                       if (self.pageYOffset) {
  83. -                               yScroll = self.pageYOffset;
  84. -                               xScroll = self.pageXOffset;
  85. -                       } else if (document.documentElement && document.documentElement.scrollTop) {     // Explorer 6 Strict
  86. -                               yScroll = document.documentElement.scrollTop;
  87. -                               xScroll = document.documentElement.scrollLeft;
  88. -                       } else if (document.body) {// all other Explorers
  89. -                               yScroll = document.body.scrollTop;
  90. -                               xScroll = document.body.scrollLeft;    
  91. -                       }
  92. -                       arrayPageScroll = new Array(xScroll,yScroll);
  93. -                       return arrayPageScroll;
  94. +                       arr = new Array($(window).scrollLeft(), $(window).scrollTop());
  95. +                       return arr;
  96.                 };
  97.                  /**
  98.                   * Stop the code execution from a escified time in milisecond