第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如果我的菜單在 header.php 中,如何滾動(dòng)到 index.php 中的特定位置

如果我的菜單在 header.php 中,如何滾動(dòng)到 index.php 中的特定位置

PHP
滄海一幻覺 2023-03-26 16:24:19
我有 4 個(gè)文件:加載頁眉、內(nèi)容和頁腳的主文件夾中的 index.php。<?php  include('header.php');  echo $this->content();  include('footer.php');?>在主文件夾的 header.php 中,我也有這個(gè):<div class="header-nav">  <div class="container">    <div class="navbar-wrapper">      <div class="navbar navbar-expand-lg">        <div id="mobileMenuMain" class="collapse navbar-collapse o2 fe">          <nav class="main-nav-menu main-menu-nav navbar-arrow">            <ul class="main-nav">              <li>                <a href="<?php echo base_url(); ?>" title="home">                  <?=lang('01')?>                </a>              </li>              <?=menu(1);?>          </nav>          <!--/.nav-collapse -->        </div>        <?php if( ! empty($phone) ) { ?>        <div class="navbar-phone d-none d-lg-block o1">          <i class="material-icons">phone</i>          <?php echo trans('0438');?> :          <?php echo $phone; ?>        </div>        <?php } ?>      </div>    </div>  </div></div>以及加載多個(gè)腳本、iframe 甚至加載其他 php 文件的主要內(nèi)容文件。這個(gè) index.php 文件的位置位于主文件夾的子文件夾 views/home/ 里面:<style>  .home_hidden {    display: none !important  }    .form-search-main-01 .col-md-6,  .form-search-main-01 .col-md-5,  .form-search-main-01 .col-md-4,  .form-search-main-01 .col-md-3,  .form-search-main-01 .col-md-2 {    width: 100% !important;    flex: 0 0 100%;    max-width: 100%;  }
查看完整描述

2 回答

?
BIG陽

TA貢獻(xiàn)1859條經(jīng)驗(yàn) 獲得超6個(gè)贊

您的鏈接和內(nèi)容位于不同的 PHP 文件中并不重要,因?yàn)槟溄拥?URL,并且您仍然可以使用錨點(diǎn)將它們鏈接在一起,只要您可以為它們分配通用 ID:https:?//developer.mozilla.org/en -US/docs/Web/HTML/Element/a#Linking_to_an_element_on_the_same_page

您還可以使用 CSS 屬性scroll-behavior: smooth;以獲得更好看的滾動(dòng)效果(或使用 JavaScript執(zhí)行相同操作)


查看完整回答
反對(duì) 回復(fù) 2023-03-26
?
揚(yáng)帆大魚

TA貢獻(xiàn)1799條經(jīng)驗(yàn) 獲得超9個(gè)贊

您只需在 JavaScript 中調(diào)用一個(gè)函數(shù)即可:


<!-- JavaScript part: -->

<script type="text/javascript">

? ?function scrollTo(id){

? ? ? var element = document.getElementById(id)


? ? ? // For scrolling to the top of the container:

? ? ? element.scrollIntoView(True)


? ? ? // Alternatively, for scrolling to the bottom of the container:

? ? ? element.scrollIntoView(False)

? ?}

</script>


<!-- Your container you want to scroll to: -->


<div id="container1">

? ?<!-- Content of container here -->

</div>


<!-- Link for scrolling to the container, can also be included with include from php like you do it in your navbar: -->


<a href="javascript: scrollTo('container1')">

? ?Go to container1

</a>

我希望它對(duì)你有用。

查看完整回答
反對(duì) 回復(fù) 2023-03-26
  • 2 回答
  • 0 關(guān)注
  • 128 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)