导航菜单,其中内容显示在容器php中 [英] Navigation menu where content shows in container php
本文介绍了导航菜单,其中内容显示在容器php中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,这听起来真的很混乱,试着尽可能地解释它。
我有一个导航菜单,包含以下内容。 。
Hi there, this is going to sound really confusing going to try explain it as best as i can :)
I have a navigation menu with the following..
<div class="content">
<div class="sidebar">
<div class="sidebar-dropdown"><a href="#">Navigation</a></div>
<ul id="nav">
<li><a href="panel.php" class="open"><i class="icon-home"></i> Dashboard</a>
</li>
<li class="has_sub"><a href="#"><i class="icon-list-alt"></i> Database <span class="pull-right"><i class="icon-chevron-right"></i></span></a>
<ul>
<li><a href="widgets1.html">Players</a></li>
</ul>
</li>
<li class="has_sub"><a href="#"><i class="icon-file-alt"></i> Ranks <span class="pull-right"><i class="icon-chevron-right"></i></span></a>
<ul>
<li><a href="post.html">Post</a></li>
<li><a href="login.html">Login</a></li>
<li><a href="register.html">Register</a></li>
<li><a href="support.html">Support</a></li>
<li><a href="invoice.html">Invoice</a></li>
<li><a href="profile.html">Profile</a></li>
<li><a href="gallery.html">Gallery</a></li>
</ul>
</li>
<li class="has_sub"><a href="#"><i class="icon-file-alt"></i> Pages #2 <span class="pull-right"><i class="icon-chevron-right"></i></span></a>
<ul>
<li><a href="media.html">Media</a></li>
<li><a href="statement.html">Statement</a></li>
<li><a href="error.html">Error</a></li>
<li><a href="error-log.html">Error Log</a></li>
<li><a href="calendar.html">Calendar</a></li>
<li><a href="grid.html">Grid</a></li>
</ul>
</li>
<li><a href="charts.html"><i class="icon-bar-chart"></i> Charts</a></li>
<li><a href="tables.html"><i class="icon-table"></i> Tables</a></li>
<li><a href="forms.html"><i class="icon-tasks"></i> Forms</a></li>
<li><a href="ui.html"><i class="icon-magic"></i> User Interface</a></li>
<li><a href="calendar.html"><i class="icon-calendar"></i> Calendar</a></li>
</ul>
</div>
我希望能够点击一个链接,例如Dashboard,它必须去我的包含文件并获取dashboard.php并在此处插入内容...
And i would like to be able to click one link for example "Dashboard" and it must go to my includes file and get the dashboard.php and insert the content in here...
<div class="matter">
<div class="container">
</div>
</div>
在容器中。但是,如果我点击其他链接,它必须清除容器或其他东西,并将其中的包括?
我该怎么做?
In the container. but if i click on the other link it must clear container or something and put the include inside of it?
How do i do this?
推荐答案
嗨朋友,
这是一个使用jQuery的简单解决方案。
Hi Friend,
Here's a simple solution using jQuery.
<!-- Inside the HEAD TAG : Youu have to change the jQuery path correctly -->
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
( document )。ready( function (){
// 任何时候单击ul#nav li中的链接,将调用此事件并执行其中的回调函数
(document).ready(function(){ // When any link inside the ul#nav li is clicked, this event will be called and the callback function inside it is executed
( #nav li a)。click( function (){
< span class =code-comment> // 我们会的l使用AJAX从includes /文件夹中获取数据(因为您已将所有链接命名为文件名,因此它
// 变得轻松
var link = 包含/ +
("#nav li a").click(function(){ // We will be using AJAX to get the data from includes/ folder (Since you have named all the links as their filename so it is // going to be easy var link = "includes/" +
这篇关于导航菜单,其中内容显示在容器php中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文