lokesh / lightbox2

THE original Lightbox script (v2).
http://lokeshdhakar.com/projects/lightbox2/
MIT License
6.2k stars 1.77k forks source link

Vertical resize doesn't work with HTML 4.01 #704

Closed andysh996 closed 3 years ago

andysh996 commented 3 years ago

Hello, first of all let me say thanks for this script, I love it :)

I just realized that there's a problem with vertical resize when the page is HTML 4.01. This happens in every modern browser, but NOT in Internet Explorer 11, where it works the way it should.

Here's you two examples with the same exact sample page in the latest Firefox:

Is there a way to fix this? I need to use lightbox2 with some "old" 4.01 web pages. Any help would be much appreciated :)

andysh996 commented 3 years ago

Perhaps, could it have to do with Quirks mode?

andysh996 commented 3 years ago

Here's you the two examples, same files, same css and same lightbox2 script (latest version):

  1. With the HTML5 tag: https://lightbox.tiiny.site/
  2. With the HTML4 tag: https://lightbox2.tiiny.site/
andysh996 commented 3 years ago

Nobody? Maybe I'm the only one having this problem?

CommodoreSixtyFour commented 3 years ago

It's not just you. Luckily for me, using DOCTYPE html was a good enough workaround, so thanks for that tip!

andysh996 commented 3 years ago

It's not just you. Luckily for me, using DOCTYPE html was a good enough workaround, so thanks for that tip!

No problem, glad I helped someone indirectly :)

Unfortunately I can’t fix it this way...replacing the doctype would screw the layout of my website (since it’s done with tables and deprecated tags)...

CommodoreSixtyFour commented 3 years ago

The issue seems to be jQuery reporting the document height as the window height.

I think I found a solution for you. In lightbox-plus-jquery.js, find the line that reads:

windowHeight = $(window).height();

change it to:

windowHeight = window.innerHeight;

That seems to work on my page, at least.

I don't know if windowWidth is affected in the same way, but if it is, change that line to windowWidth = window.innerWidth;

andysh996 commented 3 years ago

change it to:

windowHeight = window.innerHeight;

Well...it worked! Thank you so much @CommodoreSixtyFour ...and cool nickname by the way :)

CommodoreSixtyFour commented 3 years ago

Got started with a C64 back in the day. It's only fair to pay homage to it. :)

Glad you got your issue solved!