diff options
author | Andrew Dolgov <[email protected]> | 2021-03-12 13:04:44 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-03-12 13:04:44 +0300 |
commit | fe7e71133be7bebd909e5faf51daa612537937d3 (patch) | |
tree | b5850d69e5589840a1661452139152d3047ec605 | |
parent | e3192939ac9ae66247a08c19fdd5872e801647ed (diff) |
filter out invisible rows
-rw-r--r-- | init.js | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -12,7 +12,9 @@ require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) { }), intersection_observer: new IntersectionObserver( (entries, observer) => { - entries.forEach((entry) => Plugins.Grid_Masonry.fit_row(entry.target)); + entries.forEach((entry) => { + if (entry.isIntersecting) Plugins.Grid_Masonry.fit_row(entry.target)} + ); }, {threshold: [0, 0.5, 1], root: document.querySelector("#headlines-frame")} ), @@ -35,7 +37,7 @@ require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) { fit_row: function(row) { const num_columns = this.get_columns(); - if (num_columns < 2) + if (num_columns < 2 || !Headlines.isChildVisible(row)) return; const row_idx = this.rows.indexOf(row); @@ -67,8 +69,10 @@ require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) { this.rows.forEach((row) => { this.resize_observer.observe(row); - //this.mutation_observer.observe(row, {attributes: true}); this.intersection_observer.observe(row); + + // expand-shrink button + this.mutation_observer.observe(row, {attributes: true}); }) } } |