summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStella Power2007-10-04 14:09:37 (GMT)
committer Stella Power2007-10-04 14:09:37 (GMT)
commita24a86bb0844820aebd97dd4319f1a2658d19979 (patch)
tree910b6d7582d042be4129270566957dff663f8b64
parent84ebd4c28b3b36b7d8bcf82dbb6d0a2c438192c7 (diff)
fixed prob with hardcoded paths for loading and close images
-rw-r--r--css/lightbox_lite.css75
-rw-r--r--js/lightbox_lite.js71
2 files changed, 63 insertions, 83 deletions
diff --git a/css/lightbox_lite.css b/css/lightbox_lite.css
index 01c1bb5..404633a 100644
--- a/css/lightbox_lite.css
+++ b/css/lightbox_lite.css
@@ -1,28 +1,57 @@
#lightbox {
- background-color: #eee;
- padding: 10px;
- border-bottom: 2px solid #666;
- border-right: 2px solid #666;
+ background-color: #eee;
+ padding: 10px;
+ border-bottom: 2px solid #666;
+ border-right: 2px solid #666;
+ min-width: 240px;
}
-
#lightboxDetails {
- font-size: 1.2em;
- padding-top: 0.6em;
-}
-
-#lightboxCaption { float: left; }
-#keyboardMsg { float: right; }
-#closeButton { top: 5px; right: 5px; }
-
-#lightbox img { border: none; clear: both;}
-#overlay img { border: none; }
-
-#overlay { background-image: url(../images/overlay.png); }
-
+ font-size: 1.2em;
+ padding-top: 0.6em;
+ min-width: 240px;
+}
+#lightboxCaption {
+ float: left;
+}
+#keyboardMsg {
+ float: right;
+}
+#closeButton {
+ top: 5px;
+ right: 5px;
+ width: 20px;
+ height: 20px;
+ position: absolute;
+ z-index: 200;
+ background: url(../images/close_lite.gif) no-repeat;
+}
+#loadingImage {
+ position: absolute;
+ top: 30%;
+ left: 45%;
+ *left: 0%;
+ height: 25%;
+ width: 100%;
+ text-align: center;
+ line-height: 0;
+ background: url(../images/loading_lite.gif) no-repeat;
+ width: 126px;
+ height: 22px;
+ z-index: 150;
+}
+#lightbox img {
+ border: none;
+ clear: both;
+}
+#overlay img {
+ border: none;
+}
+#overlay {
+ background-image: url(../images/overlay.png);
+}
* html #overlay {
- background-color: #333;
- back\ground-color: transparent;
- background-image: url(../images/blank.gif);
- filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../images/overlay.png", sizingMethod="scale");
+ background-color: #333;
+ back\ground-color: transparent;
+ background-image: url(../images/blank.gif);
+ filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../images/overlay.png", sizingMethod="scale");
}
-
diff --git a/js/lightbox_lite.js b/js/lightbox_lite.js
index 4c7630b..cea532d 100644
--- a/js/lightbox_lite.js
+++ b/js/lightbox_lite.js
@@ -31,15 +31,6 @@
-// Configuration
-
-// If you would like to use a custom loading image or close button reference them in the next two lines.
-var loadingImage = '/modules/lightbox2/images/loading_lite.gif';
-var closeButton = '/modules/lightbox2/images/close_lite.gif';
-
-
-
-
//
// getPageScroll()
@@ -136,7 +127,7 @@ function getPageSize() {
// pause(numberMillis)
-function pause(numberMillis) {
+function pause(ms) {
var date = new Date();
curDate = null;
do { var curDate = new Date(); }
@@ -178,13 +169,6 @@ function showLightbox(objLink) {
var arrayPageSize = getPageSize();
var arrayPageScroll = getPageScroll();
- // center loadingImage if it exists
- if (objLoadingImage) {
- objLoadingImage.style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - objLoadingImage.height) / 2) + 'px');
- objLoadingImage.style.left = (((arrayPageSize[0] - 20 - objLoadingImage.width) / 2) + 'px');
- objLoadingImage.style.display = 'block';
- }
-
// set height of Overlay to take up whole page and show
objOverlay.style.height = (arrayPageSize[1] + 'px');
objOverlay.style.display = 'block';
@@ -329,31 +313,10 @@ function initLightbox() {
var arrayPageSize = getPageSize();
var arrayPageScroll = getPageScroll();
- // preload and create loader image
- var imgPreloader = new Image();
-
- // if loader image found, create link to hide lightbox and create loadingimage
- imgPreloader.onload = function() {
-
- var objLoadingImageLink = document.createElement("a");
- objLoadingImageLink.setAttribute('href', '#');
- objLoadingImageLink.onclick = function () { hideLightbox(); return false; }
- objOverlay.appendChild(objLoadingImageLink);
-
- var objLoadingImage = document.createElement("img");
- objLoadingImage.src = loadingImage;
- objLoadingImage.setAttribute('id', 'loadingImage');
- objLoadingImage.style.position = 'absolute';
- objLoadingImage.style.zIndex = '150';
- objLoadingImageLink.appendChild(objLoadingImage);
-
- // clear onLoad, as IE will flip out w/animated gifs
- imgPreloader.onload = function() {};
-
- return false;
- }
-
- imgPreloader.src = loadingImage;
+ // create loader image
+ var objLoadingImage = document.createElement("span");
+ objLoadingImage.setAttribute('id', 'loadingImage');
+ objOverlay.appendChild(objLoadingImage);
// create lightbox div, same note about styles as above
var objLightbox = document.createElement("div");
@@ -370,23 +333,10 @@ function initLightbox() {
objLink.onclick = function () {hideLightbox(); return false;}
objLightbox.appendChild(objLink);
- // preload and create close button image
- var imgPreloadCloseButton = new Image();
-
- // if close button image found,
- imgPreloadCloseButton.onload = function() {
-
- var objCloseButton = document.createElement("img");
- objCloseButton.src = closeButton;
- objCloseButton.setAttribute('id', 'closeButton');
- objCloseButton.style.position = 'absolute';
- objCloseButton.style.zIndex = '200';
- objLink.appendChild(objCloseButton);
-
- return false;
- }
-
- imgPreloadCloseButton.src = closeButton;
+ // create close button image
+ var objCloseButton = document.createElement("span");
+ objCloseButton.setAttribute('id', 'closeButton');
+ objLink.appendChild(objCloseButton);
// create image
var objImage = document.createElement("img");
@@ -405,9 +355,10 @@ function initLightbox() {
objLightboxDetails.appendChild(objCaption);
// create keyboard message
+ var settings = Drupal.settings.lightbox2;
var objKeyboardMsg = document.createElement("div");
objKeyboardMsg.setAttribute('id', 'keyboardMsg');
- objKeyboardMsg.innerHTML = Drupal.t('press <a href="#" onclick="hideLightbox(); return false;"><kbd>x</kbd></a> to close');
+ objKeyboardMsg.innerHTML = settings.lite_press_x_close;
objLightboxDetails.appendChild(objKeyboardMsg);