有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java从外部链接到引导选项卡

我有个问题,希望你能帮我从外部链接到一个标签。它每次都会得到第一个链接 这是我的代码:

导航栏

              <li class="has-children"><a href="#">Produktionsprozess</a> 
                <ul>
                            <li><a href="#warenlogistik">Warenlogistik</a></li>
                            <li><a href="#fotoproduktion">Fotoproduktion</a></li>
                            <li><a href="#abstimmung">Abstimmung & Freigabe</a></li>
                            <li><a href="#postproduction">Postproduktion</a></li>

活动部分:

            <ul data-animate class="row list-unstyled action-list inline-type-2 bottom-space" role="tablist">
                <li role="presentation" class="col-lg-4 col-sm-6 bottom-space has-corner-line corner-anim active">
                    <a class="tab secondary-headline has-icon corner-anim" href="#warenlogistik" aria-controls="warenlogistik" role="tab" data-toggle="tab">
                        <i class="fi flaticon-shuffle"></i>
                        <h3 class="maintitle">Waren<strong>logistik</strong></h3>
                        <p class="subtitle">Roadtrip to reach your goals</p>

                        <span class="corner corner-1"></span>
                        <span class="corner corner-2"></span>
                    </a>
                </li>

我够不着的部分:

                <li role="presentation" class="col-lg-4 col-sm-6 bottom-space has-corner-line corner-anim">
                    <a class="tab secondary-headline has-icon" href="#fotoproduktion" aria-controls="fotoproduktion" role="tab" data-toggle="tab">
                        <i class="fi flaticon-technology"></i>
                        <h3 class="maintitle">Foto<strong>produktion</strong></h3>
                        <p class="subtitle">Photography at its best</p>

                        <span class="corner corner-1"></span>
                        <span class="corner corner-2"></span>
                    </a>
                </li>

同样在网格容器或手风琴中,我有这个代码。它适用于“warenlogistik”第一个,但不适用于第二个“fotoproduktion”:

            <article class="row tab-pane in fade active" id="warenlogistik">
                <div class="col-sm-6">
                    <figure>
                        <img src="images/pictures/produktionsprozess/warenlogistik.jpg" alt="Make a concept" />
                    </figure>
                </div>                      

<div class="col-sm-6">
                            <div class="secondary-headline">
                                <h3 class="maintitle">Waren<strong>logistik</strong></h3>
                                <h4 class="subtitle">Feel the innovation</h4>
                            </div> <p> text text text </p></div></article>


<article class="row tab-pane fade" id="fotoproduktion">
                        <div class="col-sm-6">
                            <figure>
                                <img src="images/pictures/produktionsprozess/fotoproduktion.jpg" alt="Make a concept" />
                            </figure>
                        </div><div class="col-sm-6">
                            <div class="secondary-headline">
                                <h3 class="maintitle">Foto<strong>Produktion</strong></h3>
                                <h4 class="subtitle">text text</h4>
                            </div><p> text text text </p>
                    </div>
                </article>

剧本。js:

    $('a[data-toggle="tab"]') .on('shown.bs.tab', function() { 
        $window.trigger ('resize');
    });

剧本。min.js: .....

a('a[data-toggle="tab"]').on ("shown.bs.tab",function()
{b.trigger("resize")}) ,
b.on("load",function()
{a(".preloader").
fadeOut("slow"), 
a("body").addClass("loaded")}

然后我在引导程序中找到了一些东西。min.js

我会从4小时后开始尝试。。。对不起,我没有拿到密码板

希望有人能帮忙

问候 马库斯

我已经试过剧本了。但是它不起作用:

$('#tab1 a').click(function (e) {
    e.preventDefault();
    $('a[href="' + $(this).attr('href') + '"]').tab('show');
})

})

编辑: 好的,我在开头使用了data toggle=“tab”,但我仍然无法跳转到该部分。刚刚开始

<li class="has-children"><a href="#">Produktionsprozess</a> 
                    <ul>
                                <li><a href="#warenlogistik" data-toggle="tab">Warenlogistik</a></li>
                                <li><a href="#fotoproduktion" data-toggle="tab">Fotoproduktion</a></li>
                                <li><a href="#abstimmung" data-toggle="tab">Abstimmung & Freigabe</a></li>
                                <li><a href="#postproduction" data-toggle="tab">Postproduktion</a></li>

我还补充说:

$(function () {
$('#fotoproduktion a').click(function (e) {
    e.preventDefault();
    $('a[href="' + $(this).attr('href') + '"]').tab('show');
})

要了解我在说什么,请看以下内容: https://www.bnecreative.com/blog/deeplink-bootstrap-tabs/

水龙头可以打开,这不再是问题所在。但我想打开非活动选项卡并向下滚动到它。到目前为止,我必须打开导航栏中带有链接的选项卡,并手动向下滚动到内容


共 (1) 个答案

  1. # 1 楼答案

    从您的问题中我可以看出,您希望能够从<a>链接访问各个选项卡。如果是的话

    您必须使用jquery来引导链接,而不是使用带有href的静态链接

    JQUERY

    $(function () {
        $('#tab1 a').click(function (e) {
            e.preventDefault();
            $('a[href="' + $(this).attr('href') + '"]').tab('show');
        })
    });
    

    HTML

    <a id="tab1" href="#postproduction">tab 1</a>