我在标题中有一个平滑的滚动'开始'菜单,用于控制客户WP网站主页的锚点。当移动到导航中的另一个辅助页面时,“开始”菜单中的链接将其当前页面的路径与末尾的锚点集成在一起。这显然使这个菜单无用,除非在主页上。目标是在该菜单中获取这些链接,将它们带回主页的正确部分。我的header.php文件中的当前代码是:
<!DOCTYPE HTML>
<html>
<head>
<link rel="shortcut icon" href="http://www.website.com/favicon.ico">
<link rel="shortcut icon" href="http://www.website.com/favicon.gif">
<meta name = "viewport" content = "width = device-width, initial-scale = 1.0, user-scalable=no">
<meta charset = "utf-8">
<meta name="description" content="">
<meta name="author" content="Arch Creative Group">
<title>MadDash E-Media</title>
<link href='http://fonts.googleapis.com/css?family=Oswald:300' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<link href = "<?php bloginfo('template_directory'); ?>/css/bootstrap.min.css" rel = "stylesheet">
<link href = "<?php bloginfo('template_directory'); ?>/css/theme.css" rel = "stylesheet">
<script src = "<?php bloginfo('template_directory'); ?>/js/respond.js"></script>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script type="text/javascript">
piAId = '22962';
piCId = '1182';
(function() {
function async_load(){
var s = document.createElement('script'); s.type = 'text/javascript';
s.src = ('https:' == document.location.protocol ? 'https://pi' : 'http://cdn') + '.pardot.com/pd.js';
var c = document.getElementsByTagName('script')[0]; c.parentNode.insertBefore(s, c);
}
if(window.attachEvent) { window.attachEvent('onload', async_load); }
else { window.addEventListener('load', async_load, false); }
})();
</script>
<script src = "http://code.jquery.com/jquery-latest.min.js"></script>
<script src = "<?php bloginfo('template_directory'); ?>/js/bootstrap.min.js"></script>
<script src="<?php bloginfo('template_directory'); ?>/js/smoothscroll.js"></script>
<?php wp_head(); ?>
<script src='http://player.ooyala.com/v3/46e60606c10d4c2387642b934b3b694e'></script>
</head>
<?php $ID = $post->ID; $page_id = $post->ID; ?>
<body>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-338928-12', 'maddash.net');
ga('send', 'pageview');
</script>
<div id="wrapper">
<a id="top"></a>
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class = "row text-center">
<header class = "header-bg">
<a href = "/"><img src = "<?php bloginfo('template_directory'); ?>/img/header-logo.gif" alt = "MadDash E-Media"></a>
</header>
</div>
<div class="container-fluid hidden-lg hidden-md">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
<a href="#top" class="dropdown-toggle" data-toggle="dropdown">Start Here <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#human" class="smoothScroll">HUMAN RESOURCES & RECRUITING</a></li>
<li><a href="#training" class="smoothScroll">TRAINING, SAFETY & ORIENTATION</a></li>
<li><a href="#corp" class="smoothScroll">CORPORATE COMMUNICATIONS & MARKETING</a></li>
</ul>
</li>
<li>
<a class="dropdown-toggle" data-toggle="dropdown">Solutions <b class="caret"></b></a>
<ul class="dropdown-menu title-white-menu-form">
<li>TURNKEY PRODUCTION AND HOSTING</li>
<li><a href="?page_id=5&sol=careerdash">CareerDash</a></li>
<li><a href="?page_id=5&sol=skilldash">SkillDash</a></li>
<li><a href="?page_id=5&sol=commdash">CommDash</a></li>
<li>VIDEO ADVERTISING</li>
<li><a href="?page_id=5&sol=addashjobs">AdDash For Jobs</a></li>
<li><a href="?page_id=5&sol=addash">AdDash</a></li>
<li>OTHER SERVICES</li>
<li><a href="?page_id=5&sol=alacarte">A La Carte Video</a></li>
<li>VIDEO MANAGEMENT TOOLS</li>
<li><a href="?page_id=5&sol=dashboard">DashBoard</a></li>
</ul>
</li>
<li><a href="?page_id=13">Video Gallery</a></li>
<li><a href="?page_id=11">Testimonials</a></li>
<li><a href="?page_id=9">Tool Kit</a></li>
<li><a href="?page_id=7">Contact</a></li>
<li><a href="http://www.website.com/maddashboard/index.php?r=site/login">Client Login</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
<div class = "alternate-menu-bg hidden-xs hidden-sm">
<div class = 'col-lg-8 col-lg-push-2 col-md-10 col-md-push-1 menu-holder'>
<div class = 'start-here'>
<ul class="navigation">
<a class="main" href="#top"><span class ='title-white-menu'>START HERE<br/><img src = '<?php bloginfo('template_directory'); ?>/img/down-arrow.gif' alt='down'></span></a>
<li class="n1 title-white-menu-form">I'M INTERESTED IN...</li>
<li class="n2">
<a href="#human" class="smoothScroll">
<div id = 'li001'>
<div id = 'li001-left'>
<img src = '<?php bloginfo('template_directory'); ?>/img/icon-menu-human.gif' width="49" height="48" alt="human">
</div>
<div id = 'li001-right'>
HUMAN RESOURCES<br/>& RECRUITING
</div>
</div>
</a>
</li>
<li class="n3">
<a href="#training" class="smoothScroll">
<div id = 'li002'>
<div id = 'li002-left'>
<img src = '<?php bloginfo('template_directory'); ?>/img/icon-menu-training.gif' width="49" height="48" alt="training">
</div>
<div id = 'li002-right'>
TRAINING, SAFETY &<br/>ORIENTATION
</div>
</div>
</a>
</li>
<li class="n4">
<a href="#corp" class="smoothScroll">
<div id = 'li003'>
<div id = 'li003-left'>
<img src = '<?php bloginfo('template_directory'); ?>/img/icon-menu-corporate.gif' width="49" height="48" alt="corporate">
</div>
<div id = 'li003-right'>
CORPORATE COMMUNICATIONS & MARKETING
</div>
</div>
</a>
</li>
</ul>
</div>
<div class = 'header-menu'>
<ul class = "top-menu">
<li>
<ul class="navigation-solution menu-no-style">
<a class="main" ><div class ='title-white-menu <?php if ($ID == 20) { echo "active-link"; } ?>'>SOLUTIONS</div></a>
<li class="n6"><span class = "title-orange-menu-form">TURNKEY PRODUCTION</span>
<ul>
<li><a class = "title-white-menu-form-solutions" href="?page_id=5&sol=careerdash">CareerDash</a></li>
<li><a class = "title-white-menu-form-solutions" href="?page_id=5&sol=skilldash">SkillDash</a></li>
<li><a class = "title-white-menu-form-solutions" href="?page_id=5&sol=commdash">CommDash</a></li>
</ul>
</li>
<li class="n7 title-orange-menu-form">VIDEO ADVERTISING
<ul>
<li><a class = "title-white-menu-form-solutions" href="?page_id=5&sol=addashjobs">AdDash For Jobs</a></li>
<li><a class = "title-white-menu-form-solutions" href="?page_id=5&sol=addash">AdDash</a></li>
</ul>
</li>
<li class="n8 title-orange-menu-form">OTHER SERVICES
<ul>
<li><a class = "title-white-menu-form-solutions" href="?page_id=5&sol=alacarte">A La Carte Video</a></li>
</ul>
</li>
<li class="n9 title-orange-menu-form">VIDEO MANAGEMENT TOOLS
<ul>
<li><a class = "title-white-menu-form-solutions" href="?page_id=5&sol=dashboard">DashBoard</a></li>
</ul>
</li>
</ul>
</li>
<li><img src = '<?php bloginfo('template_directory'); ?>/img/menu-divider.gif' alt="divider"></li>
<li><a class = "title-white-menu <?php if ($post->ID == 13) { echo "active-link"; }?>" href="?page_id=13">VIDEO GALLERY</a></li>
<li><img src = '<?php bloginfo('template_directory'); ?>/img/menu-divider.gif' alt="divider"></li>
<li><a class = "title-white-menu <?php if ($post->ID == 11) { echo "active-link"; }?>" href="?page_id=11">TESTIMONIALS</a></li>
<li><img src = '<?php bloginfo('template_directory'); ?>/img/menu-divider.gif' alt="divider"></li>
<li><a class = "title-white-menu <?php if ($post->ID == 9) { echo "active-link"; }?>" href="?page_id=9">TOOL KIT</a></li>
<li><img src = '<?php bloginfo('template_directory'); ?>/img/menu-divider.gif' alt="divider"></li>
<li><a class = "title-white-menu <?php if ($post->ID == 7) { echo "active-link"; }?>" href="?page_id=7">CONTACT</a></li>
<li><img src = '<?php bloginfo('template_directory'); ?>/img/menu-divider.gif' alt="divider"></li>
<li>
<ul class="navigation-contact menu-no-style">
<a class="main title-white-menu" href="#url">Client Login</a>
<li class = "n5">
<form action='http://www.website.com/maddashboard/index.php?r=site/login' method='post' name='ContactForm' id='ContactForm' class ='title-white-menu-form' target='_blank'>
<div class = "form-wrapper">
EMAIL ADDRESS:<br/>
<input class = "form-black" name="LoginForm[username]" id="LoginForm_username" type='text' maxlength='55'>
<br/>
PASSWORD:<br/>
<input class = "form-black" name="LoginForm[password]" id="LoginForm_password" type='password' maxlength='55'>
</div>
<small><input id="ytLoginForm_rememberMe" type="hidden" value="0" name="LoginForm[rememberMe]" />
<input name="LoginForm[rememberMe]" id="LoginForm_rememberMe" value="1" type="checkbox" />
<label for="LoginForm_rememberMe">Keep me logged in</label>
<div id="LoginForm_rememberMe_em_" class="errorMessage" style="display:none"></div></small>
<div style = "float:right;"><a class ="forgot-password" href = "http://www.website.com/passwordrequest">FORGOT PASSWORD?</a>
<button type ='submit' name ='submit' id ='submit' value='Submit' style='border: 0; background: transparent; ' >
<img src ='<?php bloginfo('template_directory'); ?>/img/btn-login.gif' width ='75' height='23' alt ='submit' />
</button></div>
</form>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</nav><!-- /.navigation -->
我意识到这是一个更好的方法来做到这一点,我只是不确定,我现在的开发人员是MIA。任何帮助将非常感激!