我需要有关英特尔 XDK 的帮助,如何为每个页面应用不同的背景样式。目前,当我为特定页面选择一种背景样式时,它会自动应用于所有其他页面。
P.S,我正在设计模式下开发一个应用程序。
你可以通过扔js来做到这一点,通过改变你的身体风格取决于路由/网址 例如,如果你使用 Angularjs,它就会像那样
.state('home', {
url: '/',
templateUrl: 'index.html',
controller: 'HomeController',
containerClass: 'Homecss'
})
.state('otherpage', {
url: '/otherpage',
templateUrl: 'otherpage.html',
controller: 'otherpageController',
containerClass: 'otherpagecss'
})
然后
$rootScope.$on('$stateChangeSuccess',function(event, toState, toParams, fromState, fromParams){
$rootScope.containerClass = toState.containerClass;
});
在你的html中
<div ng-class="{{containerClass}}">...</div>
还有 angularjs 模块可以帮助简化操作,例如 angular-css