Article.cdmScrollToId: disable smooth scrolling in collapsed combined mode

This commit is contained in:
Andrew Dolgov 2019-12-10 08:58:32 +03:00
parent 560346f9d1
commit a40f22d8aa
1 changed files with 3 additions and 2 deletions

View File

@ -278,13 +278,14 @@ define(["dojo/_base/declare"], function (declare) {
cdmScrollToId: function (id, force, event) { cdmScrollToId: function (id, force, event) {
const ctr = $("headlines-frame"); const ctr = $("headlines-frame");
const e = $("RROW-" + id); const e = $("RROW-" + id);
const is_expanded = App.getInitParam("cdm_expanded");
if (!e || !ctr) return; if (!e || !ctr) return;
if (force || e.offsetTop + e.offsetHeight > (ctr.scrollTop + ctr.offsetHeight) || if (force || is_expanded || e.offsetTop + e.offsetHeight > (ctr.scrollTop + ctr.offsetHeight) ||
e.offsetTop < ctr.scrollTop) { e.offsetTop < ctr.scrollTop) {
if (event && event.repeat) { if (event && event.repeat || !is_expanded) {
ctr.addClassName("forbid-smooth-scroll"); ctr.addClassName("forbid-smooth-scroll");
window.clearTimeout(this._scroll_reset_timeout); window.clearTimeout(this._scroll_reset_timeout);