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

Tooltip positioning in body is wrong when using fixed navbar #532

Closed
abuzakaria opened this issue Feb 12, 2016 · 17 comments
Closed

Tooltip positioning in body is wrong when using fixed navbar #532

abuzakaria opened this issue Feb 12, 2016 · 17 comments
Labels

Comments

@abuzakaria
Copy link

When using a navigation bar with bootstrap's navbar-fixed-top, intro.js tooltips are wrongly positioned.

@haszsm
Copy link

haszsm commented Feb 18, 2016

I am having a similar issue. Please see fiddle: https://jsfiddle.net/g25my5tf/8/
I have a fixed footer here, but on my development site I have a fixed header. It also causes havoc when a tooltip is at the bottom of the page, and then another one is floating - the page does not scroll up to the top of the page again.
Any ideas? (Sorry if I appear to be hijacking the thread!)

@afshinm
Copy link
Contributor

afshinm commented Feb 22, 2016

@abuzakaria, @haszsm Hmm, will have a look. Btw share more jsFiddles if you have.

@haszsm
Copy link

haszsm commented Feb 22, 2016

@afshinm Thank you for your reply! I have also noticed another weird positioning issue. When I have a floating guide after a step, the scroll does not seem to go to the top to show it in the center of the window: https://jsfiddle.net/f1640gep/1/

@dephora
Copy link

dephora commented Apr 21, 2016

I too am having issues with fixed elements being pushed from their location and in turn having the toolTip off by an amount equal to the size of the element it just pushed. I have temporarily resolved this by overriding the following to ...

.introjs-fixedTooltip {
   position: absolute;
}

.introjs-fixParent {
  position: static;
}

This will leave the elements in place and the introjs-fixedToolTip is only slightly off at that point which can be modified for that particular step.

@rossberenson
Copy link

I encountered a similar issue as well. Mix temp fix was to add a class to the body when the tour is active. With that class, I targeted position:fixed elements and changed it to position:absolute. I know the plugin does this with the classes that are assigned to the objects BUT I noticed when I had these divs absolute, the plugin measured accurately. The position of the tool tip is in the correct position, and so is the highlighted object. Prior to this temporary fix, majority of things were off by 60px which is the height of my fixed header.

@mataps
Copy link

mataps commented Jan 30, 2017

any updates on this?

@qiuchunhong
Copy link

@afshinm Is there any solution to the first question?

@millerscout
Copy link

@Qiuu
i don't think it's a problem on intro.js itself.

this happens because the intro.js is positioning the intro at the DOM element, and exist the navbar the height is ignored.

the fix that i recommend is:

  • add the padding-top: {height-of-navbar} on the container/body

if i'm not very clear, i'm sorry but if you need a clear solution show to us a example on your environment so we can work together to fix that

@qiuchunhong
Copy link

@qiuchunhong
Copy link

right:image
wrong:image

@qiuchunhong
Copy link

@millerscout , @afshinm
Waiting for your reply

@assassin128
Copy link

@Qiuu : same problem, please help me

@sekys
Copy link

sekys commented Dec 23, 2017

Same problem. IntroJs.refresh() function helps me.

fixToolbar = function (el) {
		if (el == undefined) {
			return;
		}
		var elTop = el.getBoundingClientRect().top - document.body.getBoundingClientRect().top;

		window.addEventListener('scroll', function () {
			if (document.documentElement.scrollTop > elTop) {
				el.style.position = 'fixed';
				el.style.top = '0px';
				el.style["z-index"] = '3';
				if(window.intro != undefined) {
					window.intro.refresh();
				}
			} else {
				el.style.position = 'static';
				el.style.top = 'auto';
				el.style["z-index"] = '3';
				if(window.intro != undefined) {
					window.intro.refresh();
				}
			}
		});
	};

@decadehew
Copy link

@qiuchunhong

my solved!

.introjs-fixParent {
  position: absolute;
}

@Orlandster
Copy link

The problem which caused it for me was the scrolling. The element is fixed in the viewport, but for some reason it scroll to the bottom of the viewport.

So my fix was introJs().setOption("scrollToElement", false);

This works because I'm only using fixed elements.

@stale
Copy link

stale bot commented Oct 13, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Oct 13, 2020
@stale stale bot closed this as completed Oct 21, 2020
@mohsin1993
Copy link

mohsin1993 commented Feb 16, 2021

This worked for me

.introjs-fixedTooltip {
  position: absolute !important;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests