Replace jQuery dependent code with vanilla js

This commit is contained in:
app@dynamicweb-production 2023-04-14 05:05:35 +02:00
parent 590f7391c4
commit 5f1534c152

View file

@ -19,13 +19,15 @@
<script> <script>
$( document ).ready(function() { document.addEventListener("DOMContentLoaded", function() {
var equalizer = ".sameheight-{{product_instance.pk}}" var equalizer = ".sameheight-{{product_instance.pk}}";
var heights = $(equalizer).map(function() { var elements = document.querySelectorAll(equalizer);
return $(this).height(); var heights = Array.from(elements).map(function(el) {
}).get(), return el.offsetHeight;
});
maxHeight = Math.max.apply(null, heights); var maxHeight = Math.max(...heights);
$(equalizer).height(maxHeight); Array.from(elements).forEach(function(el) {
el.style.height = maxHeight + "px";
});
}); });
</script> </script>