From 279e5b8f37e84a512e3aa342e94ee8b7db1b9f42 Mon Sep 17 00:00:00 2001 From: Yaroslav Levchenko Date: Wed, 25 Oct 2023 13:11:32 +0300 Subject: [PATCH] Do not use context for the once function within openy_calc_scroll behaviour. --- openy_calc/js/openy_calc_submit.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/openy_calc/js/openy_calc_submit.js b/openy_calc/js/openy_calc_submit.js index 1a729eb3..e1e04a5f 100644 --- a/openy_calc/js/openy_calc_submit.js +++ b/openy_calc/js/openy_calc_submit.js @@ -9,10 +9,9 @@ */ Drupal.behaviors.openy_calc_scroll = { attach: function (context, settings) { - $(once('openy-calc-scroll', '#membership-calc-wrapper', context)) - .each(function () { - var divPosition = $(this).offset(); - $('html, body').animate({scrollTop: divPosition.top - 100}, "slow"); + once('openy-calc-scroll', '#membership-calc-wrapper').forEach((wrapper) => { + var divPosition = $(wrapper).offset(); + $('html, body').animate({scrollTop: divPosition.top - 100}, "slow"); }); } };