coliff / bootstrap-ie11

Internet Explorer 11 compatibility solution for Bootstrap 5
https://coliff.github.io/bootstrap-ie11/
MIT License
95 stars 15 forks source link

Modal Bootstrap 5 is not working in Chrome #89

Closed ltrtuan closed 3 years ago

ltrtuan commented 3 years ago

But i have error in Chrome This is my code

var myModalEl = document.querySelectorAll('#modal-video');
myModalEl.forEach(function(element){
if (typeof(element) != 'undefined' && element != null){
var modal = bootstrap.Modal.getOrCreateInstance(element);
modal.show();
}
});

The error is Uncaught TypeError: bootstrap.Modal.getOrCreateInstance is not a function If i use original bootstrap.js it works normally

coliff commented 3 years ago

You should use the original Bootstrap JS code for all browsers except IE11. This projects code is only intended to be used with IE11.

ltrtuan commented 3 years ago

Sorry to bothering you again. Chrome is working now, i have to include original Bootstrap js. Modal in IE11 is working too, But in IE11 , the function 'getOrCreateInstance' of Modal is not working. I need hide current modal to open another modal

var myModalElHide = document.getElementById(idHideModal);
var modal = bootstrap.Modal.getOrCreateInstance(myModalElHide );
modal.hide();

var myModalElShow = document.getElementById(idShowModal);
var modal = bootstrap.Modal.getOrCreateInstance(myModalElShow );
modal.show();

image

coliff commented 3 years ago

heya, sorry I'm not sure if I can help with that right now. This project was intended to focus on the CSS side of things while using polyfills to get main JS functionality. I don't have any intention to work on writing or maintaining any custom JS to address certain issues for IE11.

One thing you could consider trying is to use Babel to convert the latest Bootstrap JS to IE11-compatible code. Check this comment on another issue for details with a link to example code: https://github.com/coliff/bootstrap-ie11/issues/54#issuecomment-866098631

ltrtuan commented 3 years ago

Ok thanks so much