Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switched the scrolling behavior to center the tooltip vertically #132

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/coffee/bootstrap-tour.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@

$tip = if $element.data("bs.popover") then $element.data("bs.popover").tip() else $element.data("popover").tip()
$tip.attr("id", step.id)
@_scrollIntoView($element)
@_scrollIntoView($tip)
@_reposition($tip, step)

Expand Down Expand Up @@ -354,9 +353,8 @@

# Scroll to the popup if it is not in the viewport
_scrollIntoView: (tip) ->
tipRect = tip.get(0).getBoundingClientRect()
unless tipRect.top >= 0 && tipRect.bottom < $(window).height() && tipRect.left >= 0 && tipRect.right < $(window).width()
tip.get(0).scrollIntoView(true)
tipOffset = Math.ceil(tip.offset().top - ($(window).height() / 2))
$("html, body").stop().animate({scrollTop: tipOffset})

# Debounced window resize
_onResize: (callback, timeout) ->
Expand Down