bszn.js
2.63 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
59
60
61
62
layui.use('element', function () {
var element = layui.element;
});
layui.use('element', function () {
var element = layui.element;
//监听Tab切换,以改变地址hash值
element.on('tab(navtab)', function () {
if (this.getAttribute('lay-id') == 1) {
$("body,html").animate({ scrollTop: $(".tudi").offset().top });
$(".online_business h2").removeClass('titleActive')
$(".tudi .online_business h2").addClass('titleActive')
} else if (this.getAttribute('lay-id') == 2) {
$("body,html").animate({ scrollTop: $(".jianzhu").offset().top });
$(".online_business h2").removeClass('titleActive')
$(".jianzhu .online_business h2").addClass('titleActive')
} else if (this.getAttribute('lay-id') == 3) {
$("body,html").animate({ scrollTop: $(".linmu").offset().top });
$(".online_business h2").removeClass('titleActive')
$(".linmu .online_business h2").addClass('titleActive')
} else if (this.getAttribute('lay-id') == 4) {
$("body,html").animate({ scrollTop: $(".qita").offset().top });
$(".online_business h2").removeClass('titleActive')
$(".qita .online_business h2").addClass('titleActive')
} else {
$("body,html").animate({ scrollTop: 0 });
$(".online_business h2").removeClass('titleActive')
}
});
element.on('tab(navtab1)', function () {
if (this.getAttribute('lay-id') == 1) {
$("body,html").animate({ scrollTop: $(".tudi1").offset().top });
$(".navtab1 h2").removeClass('titleActive')
$(".tudi1 .navtab1 h2").addClass('titleActive')
} else if (this.getAttribute('lay-id') == 2) {
$("body,html").animate({ scrollTop: $(".jianzhu1").offset().top });
$(".navtab1 h2").removeClass('titleActive')
$(".jianzhu1 .navtab1 h2").addClass('titleActive')
} else if (this.getAttribute('lay-id') == 3) {
$("body,html").animate({ scrollTop: $(".linmu1").offset().top });
$(".navtab1 h2").removeClass('titleActive')
$(".linmu1 .navtab1 h2").addClass('titleActive')
} else {
$("body,html").animate({ scrollTop: 0 });
$(".navtab1 h2").removeClass('titleActive')
}
});
});
layui.use('util', function () {
let util = layui.util;
//执行
util.fixbar({
bar1: true,
bar2: true,
top: true
, click: function (type) {
console.log(type);
if (type === 'bar1') {
alert('点击了bar1')
}
}
});
});