diff --git a/core/modules/tour/js/tour.js b/core/modules/tour/js/tour.js index acede2b..bdd8855 100644 --- a/core/modules/tour/js/tour.js +++ b/core/modules/tour/js/tour.js @@ -76,6 +76,7 @@ initialize: function () { this.listenTo(this.model, 'change:tour change:isActive', this.render); this.listenTo(this.model, 'change:isActive', this.toggleTour); + $(document).on('drupalViewportOffsetChange.tour', this.refreshPosition.bind(this)); }, /** @@ -118,6 +119,21 @@ }, /** + * Refresh the position of the tour. + */ + refreshPosition: function () { + var $tour = this._getTour(); + if (this.model.get('isActive')) { + if ($tour.joyride('is_phone')) { + $tour.joyride('pos_phone'); + } + else { + $tour.joyride('pos_default'); + } + } + }, + + /** * Toolbar tab click event handler; toggles isActive. */ onClick: function (event) {