Browse Source

关于我们

gzb
guozhongbo 1 year ago
parent
commit
cac233384d
2 changed files with 121 additions and 64 deletions
  1. 30
    31
      css/about.css
  2. 91
    33
      js/about.js

+ 30
- 31
css/about.css View File

107
   left: 50%;
107
   left: 50%;
108
   transform: translate(-50%, 0);
108
   transform: translate(-50%, 0);
109
 }
109
 }
110
-.area_bot{
110
+.area_bot {
111
   margin-top: 0.3rem;
111
   margin-top: 0.3rem;
112
 }
112
 }
113
-.ab_minsin{
113
+.ab_minsin {
114
   width: 100%;
114
   width: 100%;
115
   height: 3.2rem;
115
   height: 3.2rem;
116
   position: absolute;
116
   position: absolute;
122
   left: 50%;
122
   left: 50%;
123
   transform: translateX(-50%);
123
   transform: translateX(-50%);
124
 }
124
 }
125
-.area_four{
125
+.area_four {
126
   display: flex;
126
   display: flex;
127
   justify-content: space-between;
127
   justify-content: space-between;
128
 }
128
 }
129
-.area_fs{
129
+.area_fs {
130
   width: 2.8rem;
130
   width: 2.8rem;
131
-  height: 3.2rem;
131
+  height: 3rem;
132
   background-color: white;
132
   background-color: white;
133
   color: #333333;
133
   color: #333333;
134
   text-align: center;
134
   text-align: center;
135
   padding: 0 0.1rem;
135
   padding: 0 0.1rem;
136
   box-sizing: border-box;
136
   box-sizing: border-box;
137
 }
137
 }
138
-.area_fs img{
138
+.area_fs img {
139
   width: 0.9rem;
139
   width: 0.9rem;
140
   height: 0.8rem;
140
   height: 0.8rem;
141
   margin: 0 auto 0;
141
   margin: 0 auto 0;
142
 }
142
 }
143
 .area_fs div {
143
 .area_fs div {
144
   font-size: 0.18rem;
144
   font-size: 0.18rem;
145
-  line-height: 0.4rem;
145
+  line-height: 0.5rem;
146
 }
146
 }
147
 .area_fs p {
147
 .area_fs p {
148
   font-size: 0.14rem;
148
   font-size: 0.14rem;
149
   line-height: 0.24rem;
149
   line-height: 0.24rem;
150
   margin-top: 0;
150
   margin-top: 0;
151
 }
151
 }
152
-.develop_container{
152
+.develop_container {
153
   height: 1.6rem;
153
   height: 1.6rem;
154
   position: relative;
154
   position: relative;
155
 }
155
 }
156
-.jt{
156
+.jt {
157
   position: absolute;
157
   position: absolute;
158
   top: 50%;
158
   top: 50%;
159
   transform: translateY(-50%);
159
   transform: translateY(-50%);
162
   cursor: pointer;
162
   cursor: pointer;
163
   z-index: 1000;
163
   z-index: 1000;
164
 }
164
 }
165
-.leftjt{
165
+.leftjt {
166
   left: 0;
166
   left: 0;
167
 }
167
 }
168
-.rightjt{
168
+.rightjt {
169
   right: 0;
169
   right: 0;
170
 }
170
 }
171
-.showdata{
171
+.showdata {
172
   width: 90%;
172
   width: 90%;
173
   height: 1.6rem;
173
   height: 1.6rem;
174
   margin: 0 auto;
174
   margin: 0 auto;
175
   position: relative;
175
   position: relative;
176
+  /* overflow: hidden; */
176
 }
177
 }
177
-.line{
178
+.line {
178
   width: 100%;
179
   width: 100%;
179
   height: 0.04rem;
180
   height: 0.04rem;
180
   background-color: #f3f4f8ff;
181
   background-color: #f3f4f8ff;
181
   position: absolute;
182
   position: absolute;
182
   top: 50%;
183
   top: 50%;
183
-    transform: translateY(-50%);
184
+  transform: translateY(-50%);
184
 }
185
 }
185
-.rounds{
186
+.rounds {
186
   width: 100%;
187
   width: 100%;
187
   position: absolute;
188
   position: absolute;
188
-    top: 25%;
189
-    left: 0;
190
-    transform: translate(0, -50%);
191
-    white-space: nowrap;
189
+  top: 25%;
190
+  left: 0;
191
+  transform: translate(0, -50%);
192
+  white-space: nowrap;
192
 }
193
 }
193
-.round_q{
194
+.round_q {
194
   display: inline-block;
195
   display: inline-block;
195
   width: 2.34rem;
196
   width: 2.34rem;
196
   height: 100%;
197
   height: 100%;
197
 }
198
 }
198
-.round_item{
199
+.round_item {
199
   margin: 0 auto;
200
   margin: 0 auto;
200
   width: 0.18rem;
201
   width: 0.18rem;
201
   height: 0.18rem;
202
   height: 0.18rem;
206
   position: relative;
207
   position: relative;
207
   cursor: pointer;
208
   cursor: pointer;
208
 }
209
 }
209
-.round_i{
210
+.round_i {
210
   position: absolute;
211
   position: absolute;
211
   top: 50%;
212
   top: 50%;
212
   left: 50%;
213
   left: 50%;
213
-  transform: translate(-50%,-50%);
214
+  transform: translate(-50%, -50%);
214
   width: 0.12rem;
215
   width: 0.12rem;
215
-    height: 0.12rem; 
216
-    background-color: #e4e4e4ff;
217
-    border-radius: 50%;
216
+  height: 0.12rem;
217
+  background-color: #e4e4e4ff;
218
+  border-radius: 50%;
218
 }
219
 }
219
-.round_d{
220
+.round_d {
220
   width: 0.9rem;
221
   width: 0.9rem;
221
   text-align: center;
222
   text-align: center;
222
   font-size: 0.18rem;
223
   font-size: 0.18rem;
225
   top: 0.4rem;
226
   top: 0.4rem;
226
   left: -0.35rem;
227
   left: -0.35rem;
227
 }
228
 }
228
-.active .round_item{
229
+.active .round_item {
229
   border-color: #016cff;
230
   border-color: #016cff;
230
-
231
 }
231
 }
232
 .active .round_i {
232
 .active .round_i {
233
   background-color: #016cff;
233
   background-color: #016cff;
234
-
235
 }
234
 }
236
 .active .round_d {
235
 .active .round_d {
237
   color: #016cff;
236
   color: #016cff;
238
   font-size: 0.36rem;
237
   font-size: 0.36rem;
239
   font-weight: bold;
238
   font-weight: bold;
240
-}
239
+}

+ 91
- 33
js/about.js View File

1
+// 请求接口前缀
2
+var Baseurl = "https://xhwebapitest.xhkjedu.com/dh/list";
3
+// $.ajax({
4
+//   type: "POST",
5
+//   url: Baseurl,
6
+//   data: JSON.stringify({
7
+//     examid: 434,
8
+//     classid: 9666
9
+//   }),
10
+//   dataType: "json",
11
+//   contentType: "application/json; charset=utf-8",
12
+//   success: function (data) {
13
+//     if (data.code === 0) {
14
+//       loadSectionHtml(data.obj);
15
+//     } else {
16
+//       alert(data.msg);
17
+//     }
18
+//   }
19
+// });
1
 var datalist = [
20
 var datalist = [
2
   { time: 2023 },
21
   { time: 2023 },
3
   { time: 2022 },
22
   { time: 2022 },
4
   { time: 2021 },
23
   { time: 2021 },
5
   { time: 2020 },
24
   { time: 2020 },
6
   { time: 2019 },
25
   { time: 2019 },
7
-  { time: 2018 }
26
+  { time: 2018 },
27
+  { time: 2017 }
8
 ];
28
 ];
9
 
29
 
10
 var html = "";
30
 var html = "";
11
 $.each(datalist, (idx, item) => {
31
 $.each(datalist, (idx, item) => {
12
-  html += `<div class="round_q">
32
+  html += `<div class="round_q" index = "${idx + 1}">
13
                     <div class="round_item">
33
                     <div class="round_item">
14
                     <div class="round_i"></div>
34
                     <div class="round_i"></div>
15
                     <div class="round_d">${item.time}</div>
35
                     <div class="round_d">${item.time}</div>
28
 var next = $(".rightjt");
48
 var next = $(".rightjt");
29
 
49
 
30
 var index = 1; //存放当前显示的图片的下标
50
 var index = 1; //存放当前显示的图片的下标
31
-var len = 5;
51
+var len = 5; //显示数量
32
 var interval = 5000; //位移时间间隔
52
 var interval = 5000; //位移时间间隔
33
 var timer;
53
 var timer;
34
-
54
+var offsetpx = (datalist.length - len) * divwidth; //可偏移度
55
+var offleft = 0; //当前偏移量
56
+console.log(offsetpx);
35
 function animate(offset) {
57
 function animate(offset) {
36
   console.log(index);
58
   console.log(index);
37
   var left = parseInt(list.css("left")) + offset;
59
   var left = parseInt(list.css("left")) + offset;
38
   console.log(left, offset);
60
   console.log(left, offset);
61
+  var absnum = Math.abs(offset);
62
+  if (left < 0 - offsetpx) {
63
+    //右侧没有数据时不偏移
64
+    return;
65
+  }
39
   // 边界判断
66
   // 边界判断
40
   if (offset > 0) {
67
   if (offset > 0) {
41
     offset = "+=" + offset;
68
     offset = "+=" + offset;
69
+    offleft = offleft + absnum;
70
+    console.log(offset);
42
   } else {
71
   } else {
43
     offset = "-=" + Math.abs(offset);
72
     offset = "-=" + Math.abs(offset);
73
+    offleft = offleft - absnum;
74
+    console.log(0 - absnum, absnum);
75
+  }
76
+  // if (index == datalist.length) {
77
+  //   offset = 0 - (datalist.length - 5) * absnum;
78
+  //   offleft = offset;
79
+  //   console.log(offset);
80
+  // }
81
+  console.log(offset, offleft, "当前偏移量");
82
+  if (offset >= 0) {
83
+    console.log(44444);
84
+    return;
44
   }
85
   }
45
-
46
   list.animate({ left: offset }, 300, function () {
86
   list.animate({ left: offset }, 300, function () {
47
     if (left > -200) {
87
     if (left > -200) {
48
-      console.log(22);
88
+      console.log(22, (0 - offset) * len);
49
       list.css("left", (0 - offset) * len);
89
       list.css("left", (0 - offset) * len);
50
     }
90
     }
51
-    console.log(offset * len);
52
-    if (left < offset * len) {
53
-      console.log(111);
54
-      list.css("left", 0 - offset);
91
+    if (index == datalist.length) {
92
+      offset = 0 - (datalist.length - 5) * absnum;
93
+      offleft = offset;
94
+      list.css("left", offset);
95
+      console.log(offset, 1231312);
55
     }
96
     }
56
   });
97
   });
57
 }
98
 }
59
 //亮起小圆点
100
 //亮起小圆点
60
 function showButton() {
101
 function showButton() {
61
   //当前图片的小圆点亮起,其他小圆点不亮
102
   //当前图片的小圆点亮起,其他小圆点不亮
62
-  console.log("gaoliang");
103
+  console.log(index, "gaoliang");
63
   buts
104
   buts
64
     .eq(index - 1)
105
     .eq(index - 1)
65
     .addClass("active")
106
     .addClass("active")
67
     .removeClass("active");
108
     .removeClass("active");
68
 }
109
 }
69
 
110
 
111
+$(".develop_container").bind("mouseenter", () => {
112
+  stop();
113
+});
114
+$(".develop_container").bind("mouseleave", () => {
115
+  play();
116
+});
70
 // 鼠标离开图片区域时,轮播继续
117
 // 鼠标离开图片区域时,轮播继续
71
 function play() {
118
 function play() {
72
   timer = setTimeout(function () {
119
   timer = setTimeout(function () {
88
   }
135
   }
89
 
136
 
90
   // 判断当前图片是否是最后一张
137
   // 判断当前图片是否是最后一张
91
-  if (index == 5) {
138
+  if (index == datalist.length) {
92
     index = 1;
139
     index = 1;
140
+    console.log(222222);
141
+    offleft = 0;
142
+    list.animate({ left: 0 }, 300, () => {});
93
   } else {
143
   } else {
94
     index += 1;
144
     index += 1;
95
   }
145
   }
146
+  console.log(offleft, "当前偏移量");
96
   console.log("you", index);
147
   console.log("you", index);
97
   animate(0 - divwidth);
148
   animate(0 - divwidth);
98
   showButton();
149
   showButton();
150
+  stop();
99
 });
151
 });
100
 
152
 
101
 // 左按钮事件
153
 // 左按钮事件
104
   if (list.is(":animated")) {
156
   if (list.is(":animated")) {
105
     return;
157
     return;
106
   }
158
   }
107
-
159
+  console.log(index);
108
   // 判断当前图片是否是第一张
160
   // 判断当前图片是否是第一张
109
   if (index == 1) {
161
   if (index == 1) {
110
-    index = 5;
162
+    index = datalist.length;
111
   } else {
163
   } else {
112
     index -= 1;
164
     index -= 1;
113
   }
165
   }
114
-  console.log(zuo, index);
166
+  console.log("zuo", index);
167
+  console.log(offleft, "当前偏移量");
115
   animate(divwidth);
168
   animate(divwidth);
116
   showButton();
169
   showButton();
170
+  stop();
117
 });
171
 });
118
 
172
 
119
 // 小圆点点击事件
173
 // 小圆点点击事件
120
-// buttons.each(function () {
121
-//   $(this).bind("click", function () {
122
-//     // 判断当前是否在进行动画
123
-//     if (list.is(":animated") || $(this).attr("class") == "on") {
124
-//       return;
125
-//     }
126
-//     // 获取属性
127
-//     var myIndex = parseInt($(this).attr("index"));
128
-
129
-//     //计算偏移量
130
-//     var offset = -600 * (myIndex - index);
131
-
132
-//     animate(offset);
174
+buts.each(function () {
175
+  $(this).bind("click", function () {
176
+    // 判断当前是否在进行动画
177
+    if (list.is(":animated") || $(this).attr("class") == "on") {
178
+      return;
179
+    }
180
+    // 获取属性
181
+    var myIndex = parseInt($(this).attr("index"));
182
+    console.log(myIndex);
183
+    //计算偏移量
184
+    var offset = (0 - divwidth) * (myIndex - index);
185
+    if (myIndex <= 2) {
186
+      offset = 0;
187
+      console.log(myIndex, 33333);
188
+    }
189
+    console.log(offleft, "当前偏移量");
190
+    animate(offset);
133
 
191
 
134
-//     //切换后,更新当前的偏移量
135
-//     index = myIndex;
192
+    //切换后,更新当前的偏移量
193
+    index = myIndex;
136
 
194
 
137
-//     showButton();
138
-//   });
139
-// });
195
+    showButton();
196
+  });
197
+});
140
 
198
 
141
 container.hover(stop, play);
199
 container.hover(stop, play);
142
 
200
 

Loading…
Cancel
Save