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