我有多个办公室网站,使用相同的导航下拉菜单在页面标题,让网站访问者很容易跳转到另一个办公室网站。我已经设计了下拉菜单,但我不知道如何接近服务器端编码方面,以便下拉菜单知道什么是活跃的办公页面的访问者目前在。我有三个办公室网站:
我的菜单结构是:(也是JSFIDDLE here)
<section id="ad_banner" class="container">
<div class="network">
<span class="abc_network">ABC Services</span>
<div class="dropdown" style="display:inline-block;">
<a href="#" data-toggle="dropdown" class="btn btn-default btn-sm dropdown-toggle">Office Location 1 <i class="fa fa-caret-down"></i></a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
<li role="presentation"><a role="menuitem" tabindex="1" href="index-header2.php">Office Location 2</a></li>
<li role="presentation"><a role="menuitem" tabindex="1" href="index-header3.php">Office Location 3</a></li>
</ul>
</div>
</div>
当添加新的办公地点时,我不需要手动更新所有的办公页面,我希望将下拉代码包含到我的office页面模板中(除非有人有其他建议,否则我将使用PHP包含)。我猜我将在每个office位置页面的顶部添加一个php变量,比如$page = "office location 1“,然后以某种方式将其添加到全局下拉菜单代码中。我只是不知道如何让下拉菜单自动选择页面。帮助!
发布于 2014-09-10 22:15:38
我用了一个iframe来实现这一点。
编辑:这是Fiddle:http://jsfiddle.net/yrf81u0c/5/
iframe代码:
<iframe src="#" width=100% height= 500px>
<p>Your browser does not support iframes.</p>
</iframe>Jquery:
$('a').click(function(event){
event.preventDefault();
var site = $(this).attr("href");
$('iframe').attr("src",site);
var value = $(this).text();
$("#top").text(value);
});https://stackoverflow.com/questions/25775707
复制相似问题