Commit cea06eb7 authored by Yue Cen's avatar Yue Cen Committed by Commit Bot

Fast app reinstall: Fix a bug that the scrolling shadow effect did not

show when the page is first loaded.

Bug: 835029
Change-Id: If48f9d793c23f28b76d010683f48dd4718940742
Reviewed-on: https://chromium-review.googlesource.com/1161549
Commit-Queue: Yue Cen <rsgingerrs@chromium.org>
Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Reviewed-by: default avatarWenzhao (Colin) Zang <wzang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581766}
parent d52d2fed
...@@ -17,6 +17,7 @@ body { ...@@ -17,6 +17,7 @@ body {
max-height: 300px; max-height: 300px;
overflow: auto; overflow: auto;
padding: 12px 64px 0 64px; padding: 12px 64px 0 64px;
width: 640px;
} }
.shadow { .shadow {
......
...@@ -75,18 +75,27 @@ function getSelectedPackages() { ...@@ -75,18 +75,27 @@ function getSelectedPackages() {
return selectedPackages; return selectedPackages;
} }
// Add the scrolling shadow effect. function toggleScrollShadow(container) {
(function() { const shadowThreshold = 5;
const shadowThreshold = 5; var doc = document;
var doc = document;
doc.getElementById('recommend-apps-container').onscroll = function() {
doc.getElementById('scroll-top') doc.getElementById('scroll-top')
.classList[this.scrollTop > shadowThreshold ? 'add' : 'remove']('shadow'); .classList.toggle('shadow', container.scrollTop > shadowThreshold);
doc.getElementById('scroll-bottom') doc.getElementById('scroll-bottom')
.classList .classList.toggle(
[this.scrollHeight - this.clientHeight - this.scrollTop < 'shadow',
shadowThreshold ? container.scrollHeight - container.clientHeight -
'remove' : container.scrollTop >=
'add']('shadow'); shadowThreshold);
}; }
})();
\ No newline at end of file // Add the scroll shadow effect. This contains two parts. First initialize the
// effect after all the contents have been generated. Then attach it to the
// onscroll event.
function addScrollShadowEffect() {
var doc = document;
var container = doc.getElementById('recommend-apps-container');
toggleScrollShadow(container);
container.onscroll = function() {
toggleScrollShadow(this);
};
}
\ No newline at end of file
...@@ -102,6 +102,8 @@ login.createScreen('RecommendAppsScreen', 'recommend-apps', function() { ...@@ -102,6 +102,8 @@ login.createScreen('RecommendAppsScreen', 'recommend-apps', function() {
var generateContents = {code: generateItemScript}; var generateContents = {code: generateItemScript};
appListView.executeScript(generateContents); appListView.executeScript(generateContents);
}); });
var addScrollShadowEffectScript = 'addScrollShadowEffect();';
appListView.executeScript({code: addScrollShadowEffectScript});
this.onGenerateContents(); this.onGenerateContents();
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment