From fb164108712f3bb6cf292665e316bfe77ae290d3 Mon Sep 17 00:00:00 2001 From: rfalcesSamca <32926045+rfalcesSamca@users.noreply.github.com> Date: Tue, 10 Jul 2018 09:07:21 +0200 Subject: [PATCH] Make it work with iframes When destination element is in another iframe, it is necessary to take into consideration the container offset. To get the container offset we need to set a viewport in the options. The same change must be done into tooltip.js --- src/coffee/bootstrap-tour.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/coffee/bootstrap-tour.coffee b/src/coffee/bootstrap-tour.coffee index eb11bd9c..e250d260 100644 --- a/src/coffee/bootstrap-tour.coffee +++ b/src/coffee/bootstrap-tour.coffee @@ -683,7 +683,11 @@ width: $backdropElement.innerWidth() height: $backdropElement.innerHeight() offset: $backdropElement.offset() - + #If element is in a distinct iframe, calculate offset based on viewport selector + if $backdropElement[0].ownerDocument != window.document && @_options.viewport + $offsetContainer = $(@_options.viewport.selector).offset() + elementData.offset.top+=$offsetContainer.top + elementData.offset.top+=$offsetContainer.left $backdropElement.addClass 'tour-step-backdrop' elementData = @_applyBackdropPadding step.backdropPadding, elementData if step.backdropPadding