- Issue created by @carles.zapater
- 🇪🇸Spain carles.zapater
Errors:
bootstrap_barrio.libraries.yml
... - 43: - core/.jquery.once + 43: - core/once ...
js/affix.js
29: $('[data-toggle="affix"]').once().each(function () {Console error: $(...).once is not a function
- Assigned to chetan 11
- Open on Drupal.org →Core: 10.1.0-alpha1 + Environment: PHP 7.4 & MySQL 5.7last update
about 1 year ago Waiting for branch to pass - Issue was unassigned.
- Status changed to Needs review
about 1 year ago 11:04am 16 November 2023 - 🇮🇳India chetan 11
Hi,
I have fixed the above error on my local, please check the attached MR.
Thanks. - 🇪🇸Spain carles.zapater
Please fix file 'js/affix.js'
Console error: $(...).once is not a function
- 🇪🇸Spain carles.zapater
You can see the 5.5.14 branch code:
/** * @file * Affix for Bootstrap 5. * https://www.codeply.com/users/skelly * */ (function ($, Drupal, once) { 'use strict'; Drupal.behaviors.bootstrap_barrio_affix = { attach: function (context, settings) { var toggleAffix = function (affixElement, scrollElement, wrapper) { var height = affixElement.outerHeight(), top = wrapper.offset().top; if (scrollElement.scrollTop() >= top){ wrapper.height(height); affixElement.addClass("affix"); } else { affixElement.removeClass("affix"); wrapper.height('auto'); } }; once('affixed', '[data-toggle="affix"]', context).forEach((element) => { var ele = $(element), wrapper = $('<div></div>'); ele.before(wrapper); $(window).on('scroll resize', function () { toggleAffix(ele, $(this), wrapper); }); // init toggleAffix(ele, $(window), wrapper); }); } } })(jQuery, Drupal, once);
- last update
about 1 year ago 4 fail - 🇺🇸United States joshuasosa
This fix helped resolve JS issues when aggregated. Some things, like IMCE module, break due to this error. Thanks!
- Status changed to Fixed
12 months ago 12:44am 29 November 2023 Automatically closed - issue fixed for 2 weeks with no activity.