javascript - Bootstrap tour with backdrop enabled acting strange - Stack Overflow

I am using Twitter Bootstrap Tour for a web tour. Here is the javascript to initialize it:var tour = ne

I am using Twitter Bootstrap Tour for a web tour.

Here is the javascript to initialize it:

    var tour = new Tour({
        backdrop: true,
        steps: [
        {
            element: "#keyword-link",
            title: "Title of my step",
            content: "Content of my step"
        },
        {
            element: "#keyword-dropdown",
            title: "Title of my step",
            content: "Content of my step"
        }
        ]
    }).init().start(true);

Currently I am just using test content within each step. I am trying to get the backdrop effect as shown on their own website: /

However, here is the result I have achieved:

Here is what it looks like without the backdrop:

You can see that the non-shadow portion masks the HTML perfectly, but its opacity is too high and you can't see any of the content that isn't masked. Is there a reason for this and what can I do to fix it?

I wasn't able to reproduce any kind of backdrop from within JSFiddle.

I am using Twitter Bootstrap Tour for a web tour.

Here is the javascript to initialize it:

    var tour = new Tour({
        backdrop: true,
        steps: [
        {
            element: "#keyword-link",
            title: "Title of my step",
            content: "Content of my step"
        },
        {
            element: "#keyword-dropdown",
            title: "Title of my step",
            content: "Content of my step"
        }
        ]
    }).init().start(true);

Currently I am just using test content within each step. I am trying to get the backdrop effect as shown on their own website: http://bootstraptour./

However, here is the result I have achieved:

Here is what it looks like without the backdrop:

You can see that the non-shadow portion masks the HTML perfectly, but its opacity is too high and you can't see any of the content that isn't masked. Is there a reason for this and what can I do to fix it?

I wasn't able to reproduce any kind of backdrop from within JSFiddle.

Share Improve this question asked Mar 7, 2015 at 9:55 Will HuaWill Hua 1,7482 gold badges23 silver badges33 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 3

I had this same issue trying to set up a tour with steps targeting elements nested deep in the DOM.

If you look at the DOM in Chrome dev tools and find the two overlay elements 'tour-backdrop' and 'tour-step-background' and drag them in the DOM so that they are closer (on the same level or at the parent level) to the element you are trying to highlight, you will probably see the highlighting working correctly. I believe this is probably a bug with the library.

Without doing some fiddling with the tour library itself, to get it working I moved the overlay elements to the functioning position in the DOM using the 'onShown' method for the affected steps, like so:

onShown: function() {
    $(".tour-backdrop").appendTo(".pContainer");
    $(".tour-step-background").appendTo(".pContainer");
    $(".tour-step-background").css("left", "0px");
}

Instead of onShown: you can add 'backdropContainer: '.parent class of the item you highlited' as below. It is useful when you get such strange issues in multiple cases.

var tour = new Tour({
        backdrop: true,
        steps: [
        {
            element: "#keyword-link",
            title: "Title of my step",
            content: "Content of my step"
        },
        {
            element: "#keyword-dropdown",
            title: "Title of my step",
            content: "Content of my step",
            backdropContainer: '.Parent class name of #keyword-dropdown'
        }
        ]
    }).init().start(true);

Add this to your CSS:

    .popover, 
    .popover.tour,
    .tour-backdrop,
    .tour-step-background {
        z-index: 1;
    }

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745586210a4634554.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信