0

首先,我的英语不好。感谢您阅读我的问题。

如何使用附加右侧边栏修改我的 bootstrap 3 模板(布局)?

当我滚动主页时​​,右侧边栏位置转到右侧。

<?php /* the "dokuwiki__top" id is needed somewhere at the top, because that's where the "back to top" button/link links to */ ?>
<?php /* classes mode_<action> are added to make it possible to e.g. style a page differently if it's in edit mode,
     see http://www.dokuwiki.org/devel:action_modes for a list of action modes */ ?>
<?php /* .dokuwiki should always be in one of the surrounding elements (e.g. plugins and templates depend on it) */ ?>
<div id="dokuwiki__site" ><div id="dokuwiki__top"
    class="dokuwiki site mode_<?php echo $ACT ?> <?php echo ($showSidebar) ? 'hasSidebar' : '' ?>">
    <div class="navbar navbar-default navbar-fixed-top">
        <div class="container">
        <?php tpl_includeFile('header.html') ?>
        <div class="navbar-header">
            <button class="navbar-toggle" data-toggle="collapse" data-target="#topnav" type="button">
                <span class="sr-only">Toggle Navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <?php tpl_link(wl(),$conf['title'],'accesskey="h" title="[H]" class="navbar-brand"') ?>
        </div>
        <div class="navbar-collapse collapse" id="topnav">
            <ul class="nav navbar-nav">
                <?php tpl_includeFile('tpl_menu.php') ?>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <?PHP if (class_exists(Context)) {
                $logged_info = Context::get("logged_info");
                if($logged_info){
                echo "<li ><a href=\"http://www.animint.net/?act=dispMemberInfo\">마이페이지</a></li>
                <li ><a href=\"http://www.animint.net/?act=dispMemberLogout\">로그아웃</a></li>";
                } else {
                echo "<li><a href=\"http://www.animint.net/?act=dispMemberSignUpForm\">회원가입&lt;/a></li>
                <li><a href=\"http://www.animint.net/?act=dispMemberLoginForm\">로그인&lt;/a></li>";
                } }?>
            </ul>
        </div>
        </div>
    </div>

    <div class="container not-header">
        <div class="notifications">
            <?php html_msgarea() /* occasional error and info messages on top of the page */ ?>
        </div>

        <?php if($conf['breadcrumbs']) _tpl_breadcrumbs(); ?>

        <?php $sidebar_contents = bootstrap_tpl_get_sidebar($conf['sidebar'], false); ?>

        <section class="wrapper row"><!-- PAGE ACTIONS -->
            <!-- ********** CONTENT ********** -->
            <div id="dokuwiki__content" class="<?php
                if ($ACT == 'show' && $sidebar_contents != ""):
                    ?>col-sm-<?php echo 12 - $sidebarCols; ?><?php
                    if ($sidebarPos == "Left"):
                        ?> col-sm-push-<?php echo $sidebarCols; ?> <?php
                    endif; ?><?php
                else: ?>col-xs-12<?php
                endif; ?>">
                <?php if($conf['youarehere']){ ?>
                    <div class="youarehere">
                        <?php bootstrap_tpl_youarehere() ?>
                    </div>
                <?php } ?>

                <?php tpl_flush() /* flush the output buffer */ ?>
                <?php tpl_includeFile('pageheader.html') ?>

                <div class="page" role="main">
                <!-- wikipage start -->
                    <?php
                    if ($ID == "starterbootstrap:index" && auth_quickaclcheck($id) > AUTH_CREATE) {
                        include_once("generate_index.php");
                    } else {
                        tpl_content(false); /* the main content */
                    }
                    ?>
                <!-- wikipage stop -->
                </div>

                <?php tpl_includeFile('pagefooter.html') ?>
            </div><!-- /content -->

            <!-- ********** ASIDE ********** -->
            <?php if ($ACT == 'show'): ?>
            <aside id="dokuwiki__aside" class="col-sm-<?php echo $sidebarCols; ?><?php
                if ($sidebarPos == "Left"):
                    ?> col-sm-pull-<?php echo 12 - $sidebarCols; ?><?php
                endif; ?>" data-spy="affix" data-offset-top="20">
                <center><?php _tpl_searchform() ?></center>
                <div class="row"></div>
                <?php _tpl_toc(); ?>
            </aside><!-- /aside -->
            <?php endif; ?>
        </section><!-- /wrapper -->

        <!-- ********** FOOTER ********** -->
        <footer id="dokuwiki__footer">
            <ul class="doc breadcrumb pull-right">
                <li><?php tpl_action('top', 1, ''); ?></li>
                <li><?php tpl_pageinfo() /* 'Last modified' etc */ ?></li>
            </ul>
            <?php tpl_license('button') /* content license, parameters: img=*badge|button|0, imgonly=*0|1, return=*0|1 */ ?>
        </footer><!-- /footer -->

        <?php tpl_includeFile('footer.html') ?>
    </div>

</div></div><!-- /site -->

<div class="no"><?php tpl_indexerWebBug() /* provide DokuWiki housekeeping, required in all templates */ ?></div>
<!--[if ( IE 6 | IE 7 | IE 8 ) ]></div><![endif]-->
<?php @require_once(dirname(__FILE__).'/tail-js.php'); ?>
</body>

如何修改 php 页面或 css 以修复侧边栏?请帮我... :(

模板拉取文件:https://githup.com/wwu-housing/starterbootstrap

4

1 回答 1

0

您已将宽度指定为百分比。当位置为relative时,这个百分比是父容器的百分比。当 时position: absolute;,元素会从其容器中取出,因此宽度是整个页面的百分比。为了保持统一的宽度,使用绝对和相对定位,以像素为单位指定宽度。

此外,您似乎已经覆盖了标准引导 css,以便元素right: 0;在附加时具有,这导致它一直“跳”到右边。不幸的是,您不能相对于此处position: fixed;指定的容器,使其保持在同一位置。该线程中有许多关于如何处理此问题的建议。

于 2014-08-17T18:04:45.173 回答