0

我想做一个锚Branche 1

在“die card”页面中,您可以看到Branchen带有链接的 div ( )。我的问题是,如果我单击链接Branche 1它不会进入 div Branche 1,有什么建议吗?

这是一个js小提琴

HTML

<div data-role="content" id="branchen" name="branche">
    <div data-role="header" data-theme="d">
        <a href="#menupanel" data-icon="bars" data-iconpos="notext" data-shadow="false" data-iconshadow="false" data-corners="true" data-wrapperels="span"  title="Menu"></a>
        <h1>Branchen</h1>
    </div>

    <div id="Branche">
        <p><a href="#b1">Branche 1</a></p>
        <p><a href="branche2" >Branche 2</a></p>
        <p><a href="#">Branche 3</a></p>
        <p><a href="#">Branche 4</a></p>
        <p><a href="#">Branche 5</a></p>
        <p><a href="#">Branche 6</a></p>
    </div>

    <div  id="branche1" name="b1">
        <div data-role="header" data-theme="d">
                <a href="#menupanel" data-icon="bars" data-iconpos="notext" data-shadow="false" data-iconshadow="false" data-corners="true" data-wrapperels="span"  title="Menu"></a>
                <h1>Branche 1</h1>
        </div>
                <img src="bilder/branche1.jpg" width="100%" height="100%">
    </div>

    <!-- Other branches -->

</div>
4

1 回答 1

1

您的锚链接 ( #b1) 必须匹配id,而不是name.

但是您的问题也来自 jQuery mobile。要使锚点起作用,您需要data-ajax="false"在锚点链接上指定:

<a href="#branche1" data-ajax="false">Branche 1</a>

<div id="branche1">
    ...
</div>

更新了 JSFiddle
jQuery 移动参考

于 2013-10-18T07:51:34.607 回答