Blame view

js/main.js 8.49 KB
c3e81845   liuqimichale   init website
1
  
4569bbd1   liuqimichale   init website
2
  
87e21225   Andy   new webportal
3
4
5
6
7
8
9
  		// Header position  //
  		jQuery(window).on('scroll', function() {
  			if ($(this).scrollTop() > 200) {
  				$('#header .header-inner').addClass("sticky");
  			} else {
  				$('#header .header-inner').removeClass("sticky");
  			}
4569bbd1   liuqimichale   init website
10
  		});
c3e81845   liuqimichale   init website
11
12
  
  
87e21225   Andy   new webportal
13
14
15
16
17
  		// Mobile Menu  //
  		$(function(){
  			$('#nav').slicknav({
  				'label' : '',
  				'prependTo': '.mobile-menu',
c3e81845   liuqimichale   init website
18
  
87e21225   Andy   new webportal
19
  			});
4569bbd1   liuqimichale   init website
20
  		});
c3e81845   liuqimichale   init website
21
22
  
  
87e21225   Andy   new webportal
23
24
25
26
27
28
29
30
31
32
33
34
  		// Testimonial Slider //
  		$('.testimonial-slider').owlCarousel({
  				items:1,
  				autoplay:true,
  				autoplayTimeout:3500,
  				smartSpeed: 1000,
  				autoplayHoverPause:true,
  				loop:true,
  				merge:true,
  				nav:false,
  				dots:true,
  			});
c3e81845   liuqimichale   init website
35
  
87e21225   Andy   new webportal
36
37
38
39
40
41
42
43
44
45
46
47
48
49
  		//  Portfolio //
  		$('.single-pf').owlCarousel({
  			items:1,
  			autoplay:false,
  			autoplayTimeout:4500,
  			smartSpeed: 1000,
  			autoplayHoverPause:true,
  			margin:15,
  			loop:true,
  			merge:true,
  			nav:true,
  			dots:false,
  			navText: ['PREVIOUS', 'NEXT'],
  		});
c3e81845   liuqimichale   init website
50
51
  
  
87e21225   Andy   new webportal
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
  		//  Client Slider //
  		$('.clients-slider').owlCarousel({
  			autoplay:true,
  			autoplayTimeout:3000,
  			margin:15,
  			smartSpeed: 1000,
  			autoplayHoverPause:true,
  			loop:true,
  			nav:false,
  			dots:false,
  			responsive:{
  				300: {
  					items:2,
  				},
  				480: {
  					items:3,
  				},
  				768: {
  					items:4,
  				},
  				1170: {
  					items:6,
  				}
4569bbd1   liuqimichale   init website
75
  			}
4569bbd1   liuqimichale   init website
76
  		});
c3e81845   liuqimichale   init website
77
  
87e21225   Andy   new webportal
78
79
80
81
82
  		//  Popup JS //
  		$('.popup').magnificPopup({
  			type: 'image',
  			gallery:{
  			enabled:true
4569bbd1   liuqimichale   init website
83
  			}
87e21225   Andy   new webportal
84
  		});
c3e81845   liuqimichale   init website
85
86
87
  
  
  
87e21225   Andy   new webportal
88
89
90
91
  		// stellar //
  			$.stellar({
  		  horizontalOffset: 0,
  		  verticalOffset: 0
4569bbd1   liuqimichale   init website
92
93
  		});
  
c3e81845   liuqimichale   init website
94
  
87e21225   Andy   new webportal
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
  
  		// Wow Animate  //
  		var wow = new WOW(
  		{
  			boxClass:     'wow',      // animated element css class (default is wow)
  			animateClass: 'animated', // animation css class (default is animated)
  			offset:       0,          // distance to the element when triggering the animation (default is 0)
  			mobile:       false,       // trigger animations on mobile devices (default is true)
  			live:         true,       // act on asynchronously loaded content (default is true)
  			callback:     function(box) {
  			  // the callback is fired every time an animation is started
  			  // the argument that is passed in is the DOM node being animated
  			},
  			scrollContainer: null // optional scroll container selector, otherwise use window
  		  }
  		);
  		wow.init();
c3e81845   liuqimichale   init website
112
113
  
  
87e21225   Andy   new webportal
114
115
  		/*====================================
  			Isotop
c3e81845   liuqimichale   init website
116
  		======================================*/
87e21225   Andy   new webportal
117
  		$(window).on('load', function() {
c3e81845   liuqimichale   init website
118
  
87e21225   Andy   new webportal
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
  			if ($.fn.isotope) {
                  $(".isotop-active").isotope({
                      filter: '*',
                  });
  
  					$('.works-menu ul li').on('click', function() {
                      $(".works-menu ul li").removeClass("active");
                      $(this).addClass("active");
  
                      var selector = $(this).attr('data-filter');
                      $(".isotop-active").isotope({
                          filter: selector,
                          animationOptions: {
                              duration: 750,
                              easing: 'linear',
                              queue: true,
                          }
                      });
                      return false;
                  });
              }
4569bbd1   liuqimichale   init website
140
  		});
c3e81845   liuqimichale   init website
141
142
  
  
87e21225   Andy   new webportal
143
144
145
146
147
  		// onePageNav  //
  		$('#nav').onePageNav({
  			changeHash: false,
  			scrollSpeed: 1000,
  			filter: '',
4569bbd1   liuqimichale   init website
148
  		});
c3e81845   liuqimichale   init website
149
  
87e21225   Andy   new webportal
150
  		// Scroll Up JS  //
f1cf9028   liuqimichale   软件
151
152
153
154
155
156
157
158
159
160
161
162
  		// $(function () {
  		//   $.scrollUp({
  		// 	scrollName: 'scrollUp', // Element ID
  		// 	topDistance: '300', // Distance from top before showing element (px)
  		// 	topSpeed: 300, // Speed back to top (ms)
  		// 	animation: 'fade', // Fade, slide, none
  		// 	animationInSpeed: 200, // Animation in speed (ms)
  		// 	animationOutSpeed: 200, // Animation out speed (ms)
  		// 	scrollText: ["<i class='fa fa-rocket'></i>"], // Text for element
  		// 	activeOverlay: false, // Set CSS color to display scrollUp active point, e.g '#00FFFF'
  		//   });
  		// });
c3e81845   liuqimichale   init website
163
164
  
  
87e21225   Andy   new webportal
165
166
167
168
  		// counterUp //
  		$('.counter').counterUp({
  			delay: 10,
  			time: 2500,
c3e81845   liuqimichale   init website
169
  
87e21225   Andy   new webportal
170
  		});
c3e81845   liuqimichale   init website
171
172
  
  
87e21225   Andy   new webportal
173
174
175
176
177
178
  		// Preloader
  		$(window).on('load', function() {
  				$('.loader').fadeOut('slow', function(){
  				$(this).remove();
  			});
  		});
c3e81845   liuqimichale   init website
179
  
0295c38f   Andy   add 首页新增新闻中心
180
          /*
63ff6d84   Andy   add 首页新增新闻中心
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
         @   首页topbar轮播数据渲染
         */
          var mySwiper = new Swiper ('#swiper-container-index', {
              direction: 'horizontal',
              loop: true,
              speed: 500, //设置轮播时长 可以不设置 会有个默认值
              autoplay: true,//可选选项,自动滑动
              // 如果需要分页器
              pagination: {
                  el: '.swiper-pagination',
                  clickable:true
              },
              autoplay: {
                  disableOnInteraction: false,  //点击后继续轮播(这个很重要)
                  delay: 3000,                       //自动轮播的每次的时间 可以不设置 会有个默认值
              },
              // 如果需要前进后退按钮
  
  
          });
  
          /*
0295c38f   Andy   add 首页新增新闻中心
203
204
          @	chenbiao
          @   2018-01-23
63ff6d84   Andy   add 首页新增新闻中心
205
          @   首页新闻图片轮播数据渲染
0295c38f   Andy   add 首页新增新闻中心
206
          */
0295c38f   Andy   add 首页新增新闻中心
207
208
209
210
211
212
213
214
215
216
217
218
          function indexImgSlide(){
              var indexSlideList = $('.index_slide_list');
              var imgList= [];
              //直接使用ajax访问
              $.ajax({
                  type:'get',
                  url:'newsdata/swipernewsdata.json',
                  dataType:'json',
                  success:function(data){
                      $.each(data, function(i, obj){
                          imgList.push(
                              '<div class="swiper-slide red-slide">',
63ff6d84   Andy   add 首页新增新闻中心
219
                              '<a data-href="'+obj.href+'" class="swiper-slide news_a">',
0295c38f   Andy   add 首页新增新闻中心
220
                              '<div class="news_title">',
b7db9be2   Andy   add 关于我们 荣誉轮播
221
                              '<p title="'+obj.newsTitle+'">' + obj.newsTitle + '</p>',
0295c38f   Andy   add 首页新增新闻中心
222
                              '</div>',
6c5926f5   Andy   add
223
                              '<img class="banner" src="'+obj.imgUrl+'" alt="" width="100%" height="272px">',
0295c38f   Andy   add 首页新增新闻中心
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
                              '</a>',
                              '</div>'
                          )
                      });
                      indexSlideList.html(imgList.join(' '));
                      var mySwipernews = new Swiper ('#swiper-container-news', {
                          direction: 'horizontal',
                          loop: true,
                          speed: 500, //设置轮播时长 可以不设置 会有个默认值
                          autoplay: true,//可选选项,自动滑动
                          // 如果需要分页器
                          pagination: {
                              el: '.swiper-pagination',
                              clickable:true
                          },
                          autoplay: {
                              disableOnInteraction: false,  //点击后继续轮播(这个很重要)
                              delay: 3000,                       //自动轮播的每次的时间 可以不设置 会有个默认值
                          },
                          // 如果需要前进后退按钮
  
  
                      });
                  }
              });
  
          }
  
          indexImgSlide();
  
  
          /*
          @	chenbiao
          @   2018-01-23
   		@   首页新闻列表 右侧
   		*/
          function indexNewsList(){
              var newslist = $('.newslist ul');
              var list= [];
              //直接使用ajax访问
              $.ajax({
                  type:'get',
                  url:'newsdata/newslistdata.json',
                  dataType:'json',
                  success:function(data){
                      $.each(data, function(i, obj){
                          list.push(
                              '<li>',
63ff6d84   Andy   add 首页新增新闻中心
272
                              '<p class="pos-rel red-slide">',
f7d464bd   liuqimichale   新闻动态修改
273
274
                              '<a data-href="'+obj.href+'" title="'+obj.newsTitle+'">' + obj.newsTitle ,
                              '<span class="pos-abs" style="bottom: 0px;right: 2px;color: rgba(0,0,0,0.3);font-size: 12px">'+obj.time+'</span>',
ad9dda0f   Andy   add 关于我们 荣誉轮播
275
                              '</a>',
0295c38f   Andy   add 首页新增新闻中心
276
277
278
279
280
281
282
283
                              '</p>',
                              '</li>'
                          )
                      });
                      newslist.html(list.join(' '));
                  }
              })
          }
14d5eaa8   liuqimichale   swiper
284
  
63ff6d84   Andy   add 首页新增新闻中心
285
          indexNewsList();
0295c38f   Andy   add 首页新增新闻中心
286
  
63ff6d84   Andy   add 首页新增新闻中心
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
  		/*
  		@	chenbiao
  		@   2018-01-23
  		@   打开新窗口 新闻
  		*/
          $(document).on('click','.red-slide a',function () {
              var link = $(this).attr('data-href');
              window.open(link)
          });
  
  		 /*
  		@	chenbiao
  		@   2018-01-23
  		@   切割字符串方法  commonStrandNum.cutString(str, 25)
  		*/
  
  		var commonStrandNum = {
  				/*
  				 @切割字符串
  				 @str原字符串
  				 @num字符位数
  				 */
  				cutString: function (str, num) {
  					var _str = "";
  					if (str.length >= num) {
  						var strN = str.substring(0, num);
  						strN += "...";
  						_str = strN;
  					} else {
  						_str = str;
  					}
  					return _str;
  				},
f7d464bd   liuqimichale   新闻动态修改
320
  			}