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

onbeforechange() is called before the tooltip is displayed #2007

Closed
DamienCassou opened this issue Sep 6, 2023 · 2 comments
Closed

onbeforechange() is called before the tooltip is displayed #2007

DamienCassou opened this issue Sep 6, 2023 · 2 comments
Labels

Comments

@DamienCassou
Copy link

Description

In #1377 (comment), it was suggested to use onbeforechange() to change the style of individual steps. So I'm trying something like this:

intro.onbeforechange(function () {
  console.log("tooltip", document.querySelector(".introjs-tooltip"));
});

The problem is that onbeforechange() is called before the tooltip is displayed so document.querySelector() returns null for the first step:

image

As you can see, when onbeforechange() is first called, I get null. It is only after I clicked "Next" that I got the tooltip.

Expected Behavior

I would like a way to customize the style of the first step in the wizard to make it larger.

Actual Behavior

The first step can't be customized because onbeforechange() is called before any tooltip is rendered.

Errors and Screenshots (optional)

This can be reproduced with the example/callbacks/onbeforechange.html example:

diff --git a/example/callbacks/onbeforechange.html b/example/callbacks/onbeforechange.html
index d510ac1..0789a50 100644
--- a/example/callbacks/onbeforechange.html
+++ b/example/callbacks/onbeforechange.html
@@ -72,10 +72,7 @@
       function startIntro(){
         var intro = introJs();
         intro.onbeforechange(function () {
-          if (this.currentStep() === 2) {
-            alert('You cannot continue! :P')
-            return false;
-          }
+            console.log("tooltip", document.querySelector(".introjs-tooltip"));
         });
         intro.start();
       }
-- 
2.41.0

Workaround

I guess something like #1266 could solve my issue. I don't know any other workaround.

Copy link

stale bot commented Dec 15, 2023

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 Dec 15, 2023
@DamienCassou
Copy link
Author

This is still a problem for us.

@stale stale bot closed this as completed Mar 13, 2024
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

1 participant