update scroll styles
This commit is contained in:
parent
308b423658
commit
ca13b8cbc2
23 changed files with 153 additions and 106 deletions
|
@ -1,23 +1,40 @@
|
|||
define(['browser'], function (browser) {
|
||||
|
||||
function setLayout(self, layout, selectedLayout) {
|
||||
|
||||
if (layout == selectedLayout) {
|
||||
self[layout] = true;
|
||||
document.documentElement.classList.add('layout-' + layout);
|
||||
} else {
|
||||
self[layout] = false;
|
||||
document.documentElement.classList.remove('layout-' + layout);
|
||||
}
|
||||
}
|
||||
|
||||
function layoutManager() {
|
||||
|
||||
var self = this;
|
||||
|
||||
self.setFormFactor = function (formFactor) {
|
||||
self.layout = function (layout) {
|
||||
|
||||
self.mobile = false;
|
||||
self.tv = false;
|
||||
|
||||
self[formFactor] = true;
|
||||
setLayout(self, 'mobile', layout);
|
||||
setLayout(self, 'tv', layout);
|
||||
setLayout(self, 'desktop', layout);
|
||||
};
|
||||
|
||||
// Take a guess at initial layout. The consuming app can override
|
||||
if (browser.mobile) {
|
||||
self.setFormFactor('mobile');
|
||||
} else {
|
||||
self.setFormFactor('desktop');
|
||||
}
|
||||
self.autoLayout = function () {
|
||||
|
||||
// Take a guess at initial layout. The consuming app can override
|
||||
if (browser.mobile) {
|
||||
self.layout('mobile');
|
||||
} else if (browser.tv) {
|
||||
self.layout('tv');
|
||||
} else {
|
||||
self.layout('desktop');
|
||||
}
|
||||
};
|
||||
|
||||
self.autoLayout();
|
||||
};
|
||||
|
||||
return new layoutManager();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue