+7 (902) 87-80-970
Краснотурьинск

 Lightbox from Kentico CMS and Internet Explorer

I bet you have been in situation shown on the picture, if you used “Lightbox” webpart of the Kentico CMS in Internet Explorer.

As you can see, the image was loaded, but background and border of the lightbox does not fit the image – they are too small.

Here how it should be right.

This situation occurs because lightbox scripts begins the border resize early than the image was loaded. Easy solution for the problem is resize canceling or load delay increasing

Increase of the load delay – that is good solution, however, an image could be loaded quickly, but the script will wait and wait again…

Let’s take a look at lightbox loader script. You can see it in «/CMSScripts/lightbox/lightboxLoader.js» file of your sire.

Here is TryShow function:

function TryShow()
{
    setwidhei();
    if ((windowWidth == 0 || windowHeight == 0))
    {
        setTimeout("TryShow();", loadDelay)
    }
    else
    {
        Element.hide('aspxoutput');
        mtmpobj.style.visibility = '';
        myLightbox.resizeImageContainer(windowWidth, windowHeight);
    }
}

windowWidth and windowHeight are variables which contain size of loaded image. It seems this function will wait until image is loaded. Hm…

However, size of unloaded image in the Internet Explorer is not zero, but equals of size of image which is loaded when an image cannot be loaded. And here is the problem appears!

To solve this problem we replace the line

if ((windowWidth == 0 || windowHeight == 0))

to line

if ((windowWidth < 50 || windowHeight < 50))

The size could be less or more. Please note, the script works wrong if the size of image showing by the lightbox is less 50 pixels.

And for the end, the script analyze of windowWidth and windowHeight variables in function TryShow as soon as some other. Here are line numbers in source script: 23, 54, 99.

Good luck!

Posted: 4/6/2010 9:47:07 PM by Gorchaev Mark | with 0 comments
Filed under: Explorer, Internet, Kentico, Lightbox, script, solve


Comments
Blog post currently doesn't have any comments.
Leave comment Subscribe



 Security code
 
 Introduction

Hello! My name is Alex. I will tell about our new products, Kentico CMS development and so on.

 Recent posts
 Syndication
RSS
 Post archive
Kentico Gold Partner
Products  |  Services  |  About Us  |  Portfolio
Here you can find information as to the passport for our WM-identifier 932762902436 www.megastock.com Powered by Kentico CMS