I'm starting a Meteor project and I want to use different body css classes on different pages. If I add a css class to body I get:
Attributes on <body> not supported
The only way I've found is adding the class using JS. Is there a better way to do this?
The standard practice is to set body class in respective path hooks:
Router.map(function() {
this.route('someRoute', {
path: '/someAddress',
onBeforeAction: function() {
$('body').addClass('someRouteBodyClass');
this.next();
},
onStop: function() {
$('body').removeClass('someRouteBodyClass');
},
...
};
});
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments