when moving next or previous and currently active article is entirely invisible, start moving from first visible one
This commit is contained in:
parent
7d0bbe9962
commit
3993198aa7
|
@ -256,6 +256,18 @@ define(["dojo/_base/declare"], function (declare) {
|
||||||
etop < ctop && ebottom > ctop || ebottom > cbottom && etop < cbottom
|
etop < ctop && ebottom > ctop || ebottom > cbottom && etop < cbottom
|
||||||
|
|
||||||
},
|
},
|
||||||
|
firstVisible: function() {
|
||||||
|
const rows = $$("#headlines-frame > div[id*=RROW]");
|
||||||
|
const ctr = $("headlines-frame");
|
||||||
|
|
||||||
|
for (let i = 0; i < rows.length; i++) {
|
||||||
|
const row = rows[i];
|
||||||
|
|
||||||
|
if (this.isChildVisible(row, ctr)) {
|
||||||
|
return row.getAttribute("data-article-id");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
scrollHandler: function (/*event*/) {
|
scrollHandler: function (/*event*/) {
|
||||||
try {
|
try {
|
||||||
Headlines.unpackVisible();
|
Headlines.unpackVisible();
|
||||||
|
@ -830,13 +842,15 @@ define(["dojo/_base/declare"], function (declare) {
|
||||||
let prev_id = false;
|
let prev_id = false;
|
||||||
let next_id = false;
|
let next_id = false;
|
||||||
|
|
||||||
if (!$('RROW-' + Article.getActive())) {
|
const active_row = $("RROW-" + Article.getActive());
|
||||||
|
|
||||||
|
if (!active_row) {
|
||||||
Article.setActive(0);
|
Article.setActive(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Article.getActive()) {
|
if (!Article.getActive() || (active_row && !Headlines.isChildVisible(active_row, $("headlines-frame")))) {
|
||||||
next_id = rows[0];
|
next_id = Headlines.firstVisible();
|
||||||
prev_id = rows[rows.length - 1]
|
prev_id = next_id;
|
||||||
} else {
|
} else {
|
||||||
for (let i = 0; i < rows.length; i++) {
|
for (let i = 0; i < rows.length; i++) {
|
||||||
if (rows[i] == Article.getActive()) {
|
if (rows[i] == Article.getActive()) {
|
||||||
|
@ -889,7 +903,7 @@ define(["dojo/_base/declare"], function (declare) {
|
||||||
if (!noscroll) {
|
if (!noscroll) {
|
||||||
Article.scroll(-ctr.offsetHeight / 2, event);
|
Article.scroll(-ctr.offsetHeight / 2, event);
|
||||||
} else {
|
} else {
|
||||||
if (row.offsetTop < ctr.scrollTop) {
|
if (row && row.offsetTop < ctr.scrollTop) {
|
||||||
Article.cdmScrollToId(Article.getActive(), noscroll, event);
|
Article.cdmScrollToId(Article.getActive(), noscroll, event);
|
||||||
} else if (prev_id) {
|
} else if (prev_id) {
|
||||||
Article.setActive(prev_id);
|
Article.setActive(prev_id);
|
||||||
|
|
Loading…
Reference in New Issue