最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - onbeforechange callback for intro.js - Stack Overflow

programmeradmin0浏览0评论

I've got a callback function written for the onbeforechange method. Below is the code:

introJs().onbeforechange(function() {
    if($(this).is(":visible") != true)
        if($(this).is("ui-tabs-panel") == true)
            $('.ui-tabs-nav a[href$="' + $(this).attr('id') + '"]').click();
        else
            $(this).show();
}).start();

The logic is correct (tested without calling introJs().start()) however, this callback function still doesn't get called before the next step. Any ideas?

I've got a callback function written for the onbeforechange method. Below is the code:

introJs().onbeforechange(function() {
    if($(this).is(":visible") != true)
        if($(this).is("ui-tabs-panel") == true)
            $('.ui-tabs-nav a[href$="' + $(this).attr('id') + '"]').click();
        else
            $(this).show();
}).start();

The logic is correct (tested without calling introJs().start()) however, this callback function still doesn't get called before the next step. Any ideas?

Share Improve this question asked Jun 20, 2013 at 13:47 BrandonBrandon 1031 gold badge5 silver badges11 bronze badges 1
  • Btw, I've updated my intro.js file manually with the fix for onbeforechange (wasn't getting the correct element to call the function on) – Brandon Commented Jun 20, 2013 at 13:52
Add a ment  | 

1 Answer 1

Reset to default 5

Change position start()

introJs().onbeforechange(function(targetElementId) {  
    alert("after new step");
    switch($(targetElementId).attr("data-step")) {
        case "1": doSomething1(); break;
        case "2": doSomething2(); break;
        case "3": doSomething3(); break;

    }
}).start();
发布评论

评论列表(0)

  1. 暂无评论