ashleydw / lightbox

A lightbox gallery plugin for Bootstrap
http://ashleydw.github.io/lightbox
MIT License
1.85k stars 1.3k forks source link

Backward compatibility for bootstrap v3 #233

Closed hazarartuner closed 7 years ago

hazarartuner commented 7 years ago

I like the new version of it but I need to use with my old project and it has done with bootstrap3. Thus i checked the errors for bootstrap3 and fixed them.

ashleydw commented 7 years ago

Can you confirm you've tested with both and those changes were all that are needed?

hazarartuner commented 7 years ago

Yes I confirm it. I've tested it in your examples page. Firstly, I've changed the bootstrap version to 3.3.4 in the /examples/index.html and fixed the errors. Then I set the bootstrap version as you put and tested it too.

There were two errors, first one was about the bootstrap's "modal" extension. It's api looks changed at v4. Luckily there were only one place I've found is different. To fix it, I've added try/catch block. It firstly tries to work for v4, if not, then tries to work with the old way which is compatible with v3. Rest of the modal api callings look good and doesn't give any error.

The second error was about the bootstrap's utility classes. The "img-fluid" class is not defined at v3. I wrote one line of code after the place you set "img-fluid" class to the "img" element which is setting the width of img to "100%".

They look good, you may test it too :)

By the way, sorry for my english I'm not so good at it :)

ashleydw commented 7 years ago

Great, thanks for the PR! :)

ashleydw commented 7 years ago

I've copied the docs to this new page that includes BS3 JS/CSS as an example. http://ashleydw.github.io/lightbox/bs3.html