Following is my code of menus which i include on each page like this,
<?php include('menu.php');?>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$('ul#navlist a').click(function() {
$('#navlist .active').removeClass('active');
$(this).parent().addClass('active');
var linkz = $(this).attr("href");
alert(linkz);
return false;
});
});
</script>
<ul id="navlist">
<li class="active"><a href="index.php"><span>Home</span></a></li>
<li><a href="portfolio.php"><span>Our Work</span></a></li>
<li><a href="services.php"><span>Services</span></a></li>
<li><a href="request.php"><span>Submit Project</span></a></li>
<li><a href="contact.php"><span>Contact</span></a></li>
<li><a href="about.php"><span>About</span></a></li>
</ul>
While selecting menus to move on another page my function removes and adds class to <li>.
But I'm not able to redirect on page related with that menu. var linkz shows the value of active link. How to redirect to page shown in var linkz?
( if you select Home then var linkz=index.php
if you select About then var linkz=about.php and class="active" will removed from Home and will added to About )