help.page.js
1 KB
/**
* [帮助中心]
* @author: jiangmin
* @date: 2016/07/25
*/
var queryId = location.search.split('=')[1] || '1';
var $cate = $('.cateId-' + queryId);// 当前分类
var $subsets = $('.subsets');
var parentID = queryId.substr(0, 1);// 一级分类id
/**
* 目录切换
*/
$subsets.click(function() {
var $this = $(this);
var className = $this.attr('class').split(' ')[1];
var parentId = 'parentId-' + className.split('-')[1];
var $child = $this.parent().find('.' + parentId);// 当前子分类
if ($this.hasClass('open')) {
$child.hide();
$this.removeClass('open').children('.plus').css('background-image', 'url(\'../img/help/plus.png\')');
} else {
$child.show();
$this.addClass('open').children('.plus').css('background-image', 'url(\'../img/help/minus.png\')');
}
});
if (!$cate.hasClass('big-category')) {
$('.parentId-' + parentID).show();
$('.cateId-' + parentID).find('.plus').css('background-image', 'url(\'../img/help/minus.png\')');
}