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>
|
||||
$( 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>
|
||||
|
|
Loading…
Reference in a new issue