<li><a href="maine/home#services">SERVICES</a></li>
<li><a href="maine/home#about">ABOUT</a></li>
<li><a href="maine/home#contact">CONTACT</a></li>
我正在使用CodeIgniter,并且此代码位于不同的控制器中。假设http://localhost/defctrl/function1
当你点击列表时,我想返回到我的主页"maine/home"
特定div,但上面的代码不起作用。没有../maine/home#services.
我怎么解决这个问题?
如果它在同一页面上你可以使用
<li><a href="#services"
如果是另一页
<li><a href="<?php echo base_url() ?>{route or controller name}#services"
确保加载URL
帮助程序并使用index.php
加载站点