Replace jQuery dependent code with vanilla js
This commit is contained in:
parent
590f7391c4
commit
5f1534c152
1 changed files with 11 additions and 9 deletions
|
@ -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>
|
Loading…
Reference in a new issue