...
|
...
|
@@ -42,9 +42,10 @@ function initNavScroll(opt) { |
|
|
}
|
|
|
|
|
|
// 获取url中的参数
|
|
|
function getUrlParam(name) {
|
|
|
function getUrlParam(name, url) {
|
|
|
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); // 构造一个含有目标参数的正则表达式对象
|
|
|
var r = window.location.search.substr(1).match(reg); // 匹配目标参数
|
|
|
var urlTest = url || window.location.href;
|
|
|
var r = urlTest.slice(urlTest.indexOf('?') + 1).match(reg); // 匹配目标参数
|
|
|
|
|
|
// 返回参数值
|
|
|
if (r !== null) {
|
...
|
...
|
@@ -76,6 +77,20 @@ function activeNav() { |
|
|
var $nav = $('#index_nav');
|
|
|
var index = getUrlParam('yh_channel');
|
|
|
|
|
|
// 判断是否有首页选项
|
|
|
var flag = false;
|
|
|
|
|
|
$nav.find('li').each(function() {
|
|
|
var $this = $(this);
|
|
|
var url = $this.find('a').attr('href');
|
|
|
var code = getUrlParam('content_code', url);
|
|
|
|
|
|
if (code === 'c19ffa03f053f4cac3690b22c8da26b7') {
|
|
|
flag = true;
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
});
|
|
|
getOtherIndex();
|
|
|
if (index === null) {
|
|
|
index = getUrlParam('type');
|
...
|
...
|
@@ -85,6 +100,9 @@ function activeNav() { |
|
|
$nav.find('li[data-type=' + index + ']').addClass('active').siblings().removeClass('active');
|
|
|
}
|
|
|
} else {
|
|
|
if (!flag) {
|
|
|
index -= 1;
|
|
|
}
|
|
|
$nav.find('li:not([data-nav="other"])').eq(index).addClass('active').siblings().removeClass('active');
|
|
|
}
|
|
|
|
...
|
...
|
|