Closed mopsyd closed 5 years ago
This seems to be the offending block (line 15389 from the unminified source):
/*
Enhanced Bootstrap Modals
https://mdbootstrap.com
office@mdbootstrap.com
*/
$('body').on('shown.bs.modal', '.modal', function() {
if($('.modal-backdrop').length) {
} else {
$modal_dialog = $(this).children('.modal-dialog')
if($modal_dialog.hasClass('modal-side')) {
$(this).addClass('modal-scrolling');
$('body').addClass('scrollable');
}
if($modal_dialog.hasClass('modal-frame')) {
$(this).addClass('modal-content-clickable');
$('body').addClass('scrollable');
}
}
});
$('body').on('hidden.bs.modal', '.modal', function() {
$('body').removeClass('scrollable');
});
You will notice that the block above it uses a safe closure, and does not encounter this problem (ln: 15196 ... 15382):
(function($){
// Do stuff...
})(jQuery);
A similar approach with the Bootstrap Modal section at the end of the script document would close this out without issue.
hi @mopsyd , thanks for reaching out, changing
Expected behavior
Expected that the assumption will not be made that
$
is always equal tojQuery
in the global scope.This is a really easy fix though. Just use
jQuery
all of the time instead of$
. There's really no reason to ever have this bug. It's five extra keystrokes and this will never happen. Replace-all in your editor will easily fix it.Actual behavior
Chokes when using
jQuery.noConflict();
Oops.Your working environment and MDB version information
MDB 4.4.5
Resources (screenshots, code snippets etc.)