help-common.js
1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* [帮助中心 常见问题弹框]
* @author: wsl(shuiling.wang@yoho.cn)
* @date: 2016/12/02
*/
var problemTpl = require('../../hbs/help/problem-box.hbs');
// 问题弹窗操作
var problemBox = function() {
var $problemBox;
$('.help-page').append(problemTpl());
$problemBox = $('.problem-box');
$problemBox.css({lineHeight: $(window).height() + 'px'});
$('.problem a').on('click', function() {
var ask = $(this).data('ask') || '';
var answer = $(this).data('answer') || '';
$problemBox.find('.a-area').html(ask);
$problemBox.find('.q-area').html(answer);
$problemBox.show();
$('body').css({overflow: 'hidden'});
});
$('.problem-box .close, .problem-box .mark').on('click', function() {
$problemBox.hide();
$('body').css({overflow: 'auto'});
});
};
var $subsets = $('.subsets');
/**
* 目录切换
*/
$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('.icon').removeClass('minus').addClass('plus');
} else {
$('.smll-category').hide();
$('.subsets').children('.icon').removeClass('minus').addClass('plus');
$child.show();
$subsets.removeClass('open');
$this.addClass('open').children('.icon').removeClass('plus').addClass('minus');
}
});
module.exports = problemBox;