lightbox icon indicating copy to clipboard operation
lightbox copied to clipboard

Lightbox not working on IE 11

Open samuelstein opened this issue 7 years ago • 25 comments

Hello, the lightbox examples working only on chrome and firefox. in ie only the grey overlay is shown but not the actual content. the js console shows no error. any ideas?

samuelstein avatar Nov 01 '17 14:11 samuelstein

Can you post a debug of the console, and a screenshot?

ashleydw avatar Nov 01 '17 17:11 ashleydw

yes. lightbox-ie11

samuelstein avatar Nov 02 '17 09:11 samuelstein

I can confirm this happens, will investigate soon

ashleydw avatar Nov 02 '17 15:11 ashleydw

It's due to the use of display: flex which isn't fully supported by IE

baggi97 avatar Nov 10 '17 13:11 baggi97

Is there any hacky solution to fix it temporarily (till this bug is fixed)

prasanna03 avatar Nov 14 '17 04:11 prasanna03

Any news on this? I've been trying to come up with a work around without any luck.

gg-iccc avatar Nov 15 '17 17:11 gg-iccc

This was introduced in #274, so just use 5.2.0 for now

ashleydw avatar Nov 15 '17 18:11 ashleydw

It's great that we weren't the first to find this issue.

Confirmed @ashleydw workaround by replacing our version with 5.2.0:

https://cdnjs.com/libraries/ekko-lightbox/5.2.0

kaburkett avatar Nov 30 '17 15:11 kaburkett

@RafaPolit maybe you have a suggestion on fixing the IE flex bug?

ashleydw avatar Nov 30 '17 18:11 ashleydw

Change this._$modalDialog.css('flex', '1').css('maxWidth', width); to this._$modalDialog.css('flex', '100%').css('maxWidth', width);

And you're done.

Linewalker avatar Feb 11 '18 18:02 Linewalker

Change the code as Linewalker said. And to center it on Edge (I did not test it on older IE) add on the next line

if (/*@cc_on!@*/false || !!document.documentMode) this._$modalDialog.css('margin-left', '0').css('margin-right', '0');

efnack avatar Feb 24 '18 12:02 efnack

We need this fix - fast. We used this lightbox in production and are fuc*** right now.

Please do what you can, as fast as you can. I owe you a beer then ;)

Domtaholic avatar Mar 14 '18 15:03 Domtaholic

@Domtaholic Just add the following CSS, no big deal:

.ekko-lightbox .modal-dialog {
  flex: 100%!important;
  margin-left: 0;
  margin-right: 0;
}

Did the same a moment ago, as we have to use 5.3.0 and can confirm this works with IE11.

Thanks @ashleydw for the great work.

cseelus avatar Mar 14 '18 19:03 cseelus

@Domtaholic no one here is your bitch... contribute if you want open sourced projects to add new features

kaburkett avatar Mar 14 '18 20:03 kaburkett

I fixed the issue with the following:

.ekko-lightbox {
  &.iefix {
    .modal-dialog {
      margin-left: calc(-1 * 50%);
    }
  }
}

Then, in my JS

img.ekkoLightbox({
onShown: function(){
  if(util.ieBrowserIE()){
    $('.ekko-lightbox').addClass('iefix');
   }
 }
});

Don't know if this solution is better or worse than those above, but figured I'd share.

chasepeeler avatar Jun 05 '18 17:06 chasepeeler

@cseelus solution is working. thanks!

kanlukasz avatar Jun 16 '18 10:06 kanlukasz

So what's the status? Is 5.3.0 the correct version to use or not?

giedriusr avatar Jul 26 '18 12:07 giedriusr

@giedriusr Yep, 5.3.0 works quite well

cseelus avatar Jul 26 '18 13:07 cseelus

IE 11 as well?

giedriusr avatar Jul 27 '18 06:07 giedriusr

Jep, with my additional CSS from above.

cseelus avatar Jul 27 '18 12:07 cseelus

@cseelus solution is working ! Thanks you.

For more information, i have added this on my CSS :

@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
    /* IE10+ CSS */
    .ekko-lightbox .modal-dialog {
      flex: 100%!important;
      margin-left: 0;
      margin-right: 0;
      overflow: hidden;
      -ms-overflow-style: none;
    }
}

This code detects the presence of an IE type browser and apply the style.

In my use case, some images displayed in portrait mode display the vertical or horizontal scroll bar only on IE with this new style.

So, overflow: hidden; & -ms-overflow-style: none; disable the scroll on the element and not display the horizontal and vertical scroll bars !

Hoping that it can help you !

WestFR avatar Jul 31 '18 11:07 WestFR

Hopefully fixed in https://github.com/ashleydw/lightbox/releases/tag/v5.4.0-rc

I changed the flex from 1 to 100% as per the comments above

ashleydw avatar Aug 08 '18 18:08 ashleydw

Confirming fixed in RC5.4 - images are already displaying correctly in Edge. There still presist an issue in IE, where images are displayed but not centered.

But, yeah, IE is such a dead horse that thats probably not worth even mentioning than fixing :-) Thanks for the fix

EDIT: Now I realized this issue is called IE11 fix. Well, not fixed then - image is not centered

KminekMatej avatar Sep 07 '18 08:09 KminekMatej

👍 thanks @KminekMatej

Not centered vertically or horizontally? Vertically is expected as per Bootstrap modal.

A new option verticalAlignCenter will vertically center the modal.

ashleydw avatar Sep 07 '18 09:09 ashleydw

Like this, so horizontaly: image

KminekMatej avatar Sep 07 '18 09:09 KminekMatej