Skip to content

Commit

Permalink
Add page-view-ready html class after page view is ready
Browse files Browse the repository at this point in the history
  • Loading branch information
swashbuck committed Aug 1, 2023
1 parent d11ec52 commit d4a4f86
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions js/themeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ export default class ThemeView extends Backbone.View {

initialize() {
this.setStyles();
this.resetPageViewReady();

this.listenTo(Adapt, {
'pageView:ready': this.onPageViewReady,
'device:changed': this.onDeviceResize,
remove: this.remove
});
Expand All @@ -17,6 +19,15 @@ export default class ThemeView extends Backbone.View {
this.setStyles();
}

onPageViewReady() {
// Add a class to <html> after all assets are loaded for a page.
$('html').addClass('page-view-ready');
}

resetPageViewReady() {
$('html').removeClass('page-view-ready');
}

remove() {
super.remove();
this.onRemove();
Expand Down

0 comments on commit d4a4f86

Please sign in to comment.