2fa0aa4f by 任超

style:办事指南

1 parent 3ee806de
1 layui.use('element', function () {
2 var element = layui.element;
3 });
4 layui.use('element', function () {
5 var element = layui.element;
6 //监听Tab切换,以改变地址hash值
7 element.on('tab(navtab)', function () {
8 if (this.getAttribute('lay-id') == 1) {
9 $("body,html").animate({ scrollTop: $(".tudi").offset().top });
10 $(".online_business h2").removeClass('titleActive')
11 $(".tudi .online_business h2").addClass('titleActive')
12 } else if (this.getAttribute('lay-id') == 2) {
13 $("body,html").animate({ scrollTop: $(".jianzhu").offset().top });
14 $(".online_business h2").removeClass('titleActive')
15 $(".jianzhu .online_business h2").addClass('titleActive')
16 } else if (this.getAttribute('lay-id') == 3) {
17 $("body,html").animate({ scrollTop: $(".linmu").offset().top });
18 $(".online_business h2").removeClass('titleActive')
19 $(".linmu .online_business h2").addClass('titleActive')
20 } else if (this.getAttribute('lay-id') == 4) {
21 $("body,html").animate({ scrollTop: $(".qita").offset().top });
22 $(".online_business h2").removeClass('titleActive')
23 $(".qita .online_business h2").addClass('titleActive')
24 } else {
25 $("body,html").animate({ scrollTop: 0 });
26 $(".online_business h2").removeClass('titleActive')
27 }
28 });
29 element.on('tab(navtab1)', function () {
30 if (this.getAttribute('lay-id') == 1) {
31 $("body,html").animate({ scrollTop: $(".tudi1").offset().top });
32 $(".navtab1 h2").removeClass('titleActive')
33 $(".tudi1 .navtab1 h2").addClass('titleActive')
34 } else if (this.getAttribute('lay-id') == 2) {
35 $("body,html").animate({ scrollTop: $(".jianzhu1").offset().top });
36 $(".navtab1 h2").removeClass('titleActive')
37 $(".jianzhu1 .navtab1 h2").addClass('titleActive')
38 } else if (this.getAttribute('lay-id') == 3) {
39 $("body,html").animate({ scrollTop: $(".linmu1").offset().top });
40 $(".navtab1 h2").removeClass('titleActive')
41 $(".linmu1 .navtab1 h2").addClass('titleActive')
42 } else {
43 $("body,html").animate({ scrollTop: 0 });
44 $(".navtab1 h2").removeClass('titleActive')
45 }
46 });
47 });
48 layui.use('util', function () {
49 let util = layui.util;
50 //执行
51 util.fixbar({
52 bar1: true,
53 bar2: true,
54 top: true
55 , click: function (type) {
56 console.log(type);
57 if (type === 'bar1') {
58 alert('点击了bar1')
59 }
60 }
61 });
62 });
...\ No newline at end of file ...\ No newline at end of file