0

wordpress の子テーマでアンカーを使用しています。基本テーマは Zurb Foundation Grid を使用しています。

標準のアンカー コードを使用しているだけです。

<a name="anchor">

<a href="#anchor">

「名前」はワードプレスでは機能せず、ID を使用する必要があると誰かが私に言いましたが、それでも同じ結果が得られます。私は 3 つの異なるアンカーを持っていますが、名前が異なり、すべてのタグが適切に閉じられていても、それらはすべてページ上の同じ場所に誘導されます。なぜこうなった?これは以前に私に起こったことはなく、何時間もグーグルで問題を解決できませんでした。

これは、アンカーを含むホームページの完全な html コードです。

    <?php
/*
Template Name: Homepage
*/
?>

<?php get_header(); ?>

            <div id="content" class="twelve columns">

                <div id="main" role="main">
                    <?php echo do_shortcode('[orbit-slider]') ?>
                </div> <!-- end #main -->

                <div class="row">
                    <div class="nine columns">
                    </div>
                    <div id="logoblock" class="three columns">
                        <img src="http://i44.tinypic.com/2pyw3sl.png">
                    </div>
                </div>
            </div> <!-- end #content -->


                <div class="row buttonbar">
                <div class="twelve columns rowmargintop">
                    <div id="downloads" class="four columns"><a href="#downloads">
                        <img src="http://i39.tinypic.com/2v3j8na.png">
                        <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Downloads Button Homepage') ) : ?>
<?php endif; ?>
                    </a></div>
                    <div id="locator" class="four columns"><a href="#locator">
                        <img src="http://i42.tinypic.com/25zgdwj.png">
                        <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Locator Button Homepage') ) : ?>
<?php endif; ?>

                    </a></div>
                    <div id="specials" class="four columns"><a href="#specials">
                        <img src="http://i40.tinypic.com/16101l1.png">
                        <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Specials Button Homepage') ) : ?>
<?php endif; ?>

                    </a></div>
                </div>
                </div>


                <div class="row rowmargin">
                    <div class="twelve columns">
                        <div class="twelve columns downloadbg">
                        <a id="downloads">
                        <div class="four columns downloadcontent">
                        <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Download Left') ) : ?>
<?php endif; ?>

                        </div></a>                      <div class="four columns downloadcontent">
                        <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Download Mid') ) : ?>
<?php endif; ?>

                        </div>
                        <div class="four columns downloadcontent">
                        <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Download Right') ) : ?>
<?php endif; ?>

                        </div>
                    </div>


                        <div class="twelve columns downloadbg emailmargin">
                        <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Email Me') ) : ?>
<?php endif; ?>

                        </div>

                    </div>
                </div>
                </div>


                <div class="row rowmargin">
                    <div class="twelve columns">
                    <div class="twelve columns">
                    <div class="twelve columns locatorcontent">
                    <a id="locator">
                    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Store Locator') ) : ?>
<?php endif; ?></a>
                    </div>
                    </div>
                </div>

                <div class="row"><a id="specials">
                <div class="twelve columns rowmargin">
                <div class="twelve columns">
                    <div class="twelve columns">
                    <div class="twelve columns specialcontent specialstop">
                        <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Specials Top Content') ) : ?>
<?php endif; ?>
                    </div>
                    </div>
                    <div class="twelve columns">
                    <div class="twelve columns specialcontent">
                        <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Specials Bottom Content') ) : ?>
<?php endif; ?>
                    </div>
                    </div>
                </div>
                </div></a>
                </div>

            </div> <!-- end twelve columns -->


<?php get_footer(); ?>

そして、ページを開いたときにページの完全なコードをアップロードし(ローカルatmです)、「ページソースを表示」を使用して、皆さんにさらに情報を提供できることを願っています。http://codepad.org/J9OEq49f

4

1 に答える 1

1

ラッパーから id #locator を削除します。

<div id="locator" class="four columns"><a href="#locator">

また、1 つのページで同じ名前の ID を複数使用しないでください。それはあなたのコードを壊します。ここが問題です。同じ名前の ID が複数あります。彼は、あなたのコンテンツがコードをブロックするのではなく、あなたのラッパーに固執します。

注: 既に述べたように、id 属性の代わりに name 属性を使用することもできます。

于 2013-09-10T12:34:23.503 に答える