Guest User

Untitled

a guest
Oct 18th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     /**
  2.          * Prepares image exibition; doing a image´s preloader to calculate it´s size
  3.          *
  4.          */
  5.         function _set_image_to_view() { // show the loading
  6.             // Show the loading
  7.             $('#lightbox-loading').show();
  8.             if ( settings.fixedNavigation ) {
  9.                 $('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();
  10.             } else {
  11.                 // Hide some elements
  12.                 $('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();
  13.             }
  14.             // Image preload process
  15.             var objImagePreloader = new Image();
  16.             objImagePreloader.onload = function() {
  17.                 $('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]);
  18.                 // Perfomance an effect in the image container resizing it
  19.                 width = objImagePreloader.width;
  20.                 height = objImagePreloader.height;
  21.                 width = (width > 1000) ? 1000 : width;
  22.                 height = (width == 1000) ? (1000/objImagePreloader.width)*height : height;
  23.                 $('#lightbox-image').attr("height", height);
  24.                 $('#lightbox-image').attr("width", width);
  25.                 _resize_container_image_box(width, height);
  26.                 //  clear onLoad, IE behaves irratically with animated gifs otherwise
  27.                 objImagePreloader.onload=function(){};
  28.             };
  29.             objImagePreloader.src = settings.imageArray[settings.activeImage][0];
  30.         };
Add Comment
Please, Sign In to add comment