1、首页和二级 找到头部模板以下代码
<div class="logoC_1 fl"><span>深圳</span><a href="#">【切换城市】</a></div>
替换成
<div class="logoC_1 fl city_t">
<div class="city_show"><span><?=$city?></span><a href="#">【切换城市】</a></div>
<div class="dn city_hot">
<div class="city_sj"></div>
<ul class="clearfix">
<?php
$sqls=$empire->query("select classid,classname,classpath from phome_enewsclass where bclassid=0 and showclass=0 order by myorder");
while($bqrs3=$empire->fetch($sqls)){
if($bqrs3[classname]==$city){
$class = 'class="active"';
}else{
$class = '';
}
?>
<li><a href="/<?=$bqrs3[classpath]?>/" <?="$class"?>><?=$bqrs3[classname]?></a></li>
<?php
}
?>
</ul>
</div>
</div>
<script type="text/javascript">
$(function () {
$('.city_show').on('click', function () {
$('.city_t>.city_hot').toggleClass('dn');
});
});
</script>
一级栏目头部 替换成以下代码
<div class="logoC_1 fl city_t">
<?php
$city = $class_r[$GLOBALS[navclassid]]['classname'];;
?>
<div class="city_show"><span><?=$city?></span><a href="#">【切换城市】</a></div>
<div class="dn city_hot">
<div class="city_sj"></div>
<ul class="clearfix">
<?php
$sqls=$empire->query("select classid,classname,classpath from phome_enewsclass where bclassid=0 and showclass=0 order by myorder");
while($bqrs3=$empire->fetch($sqls)){
if($bqrs3[classname]==$city){
$class = 'class="active"';
}else{
$class = '';
}
?>
<li><a href="/<?=$bqrs3[classpath]?>/" <?="$class"?>><?=$bqrs3[classname]?></a></li>
<?php
}
?>
</ul>
</div>
</div>
<script type="text/javascript">
$(function () {
$('.city_show').on('click', function () {
$('.city_t>.city_hot').toggleClass('dn');
});
});
</script>
2、找到样式文件一下样式
.logoC_1{ height:95px; line-height:95px; margin-right:80px;}
.logoC_1 span{color:#ff0000; font-size:20px;font-weight: bold;}
.logoC_1 a{color:#000;}
替换成
.logoC_1{ height:95px; line-height:95px; margin-right:80px;position: relative;}
.logoC_1 span{color:#ff0000; font-size:20px;font-weight: bold;}
.logoC_1 a{color:#000;}
.dn{display: none;}
.city_t .city_hot{position: absolute;width: 105px;padding: 10px 0;text-align: center;background-color: #fff;z-index: 99999999;top: 65px;border: 0px;left: 6px;font-size: 16px;box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.4);}
.city_t .city_hot li{height: 35px;line-height: 35px;}
.city_t .city_hot a.active,.city_t .city_hot a:hover{color: #F00;background-color: transparent;}