我需要英特尔XDK的帮助,如何为每个页面应用不同的背景样式。现在,当我为特定页面选择一个背景样式时,它会自动应用于每个其他页面。
P.S,我正在设计模式中开发应用程序。
答案 0 :(得分:0)
你可以通过改变你的身体风格依赖于溃败/网址来抛出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