Created
March 17, 2020 11:06
-
-
Save wesamly/df0acd7c477a803fd6b9e35f95c99b47 to your computer and use it in GitHub Desktop.
Revisions
-
wesamly revised this gist
Mar 17, 2020 . 1 changed file with 4 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,23 +1,18 @@ function resetSameTopElmsHeight(container, childSelector) { var cols, ph, pt, tempElms, i, ch, co, j; cols = container.find(childSelector); ph = -1; pt = -1; tempElms = []; for (i in cols) { ch = $(cols[i]).outerHeight(); co = $(cols[i]).offset(); if (pt != -1 && pt < co.top) { pt = co.top; for (j in tempElms) { $(tempElms[j]).outerHeight(ph) } ph = -1 tempElms = []; -
wesamly created this gist
Mar 17, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ function resetSameTopElmsHeight(container, childSelector) { var cols, ph, pt, tempElms, i, ch, co, j, elm; cols = container.find(childSelector); ph = -1; pt = -1; tempElms = []; for (i in cols) { elm = cols[i]; //console.log(elm) ch = elm.offsetHeight;//height(); //co = $(cols[i]).offset(); co = {top: elm.offsetTop - window.scrollY}; $(elm).data('h_t', `${ch}`) //console.log(ch, co.top) if (pt != -1 && pt < co.top) { pt = co.top; for (j in tempElms) { $(tempElms[j]).height(ph) } ph = -1 tempElms = []; } tempElms.push(cols[i]); if (ph < ch) { ph = ch; } pt = co.top; } } //Example: resetSameTopElmsHeight($('.row'), '.col-sm-6');