1var methodsAll = { 2 swiperToggleContentBuild: function (name,index) { 3 var self = $(this); 4 var autoTime = self.attr('interval-time'); 5 var slidesCount = self.attr('swiper-length'); 6 name = new Swiper('.entranceMoreWraper'+index, { 7 loop: true, 8 autoplay: autoTime == 0 || autoTime == '' ? false : { delay: autoTime,disableOnInteraction:false }, 9 slideToClickedSlide:true, 10 autoplayDisableOnInteraction: false, 11 observer:true, 12 effect: 'fade', 13 speed: 1000, 14 observeParents:true, 15 on: { 16 init: function() { 17 if (autoTime == 0 || autoTime == '') { 18 this.autoplay = false; 19 } else { 20 this.autoplay.delay = autoTime; 21 this.autoplay.disableOnInteraction = false; 22 } 23 }, 24 slideChange: function() { 25 if(this.realIndex == 0) { 26 if (window.innerWidth < 750) { 27 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper').animate({ scrollLeft: 0 }, 800); 28 } 29 // $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper').scrollLeft(0); 30 $('.entranceMoreWraper' + index + '~ .tabContent .remark1').addClass('remarkActive'); 31 $('.entranceMoreWraper' + index + '~ .tabContent .remark2').removeClass('remarkActive'); 32 $('.entranceMoreWraper' + index + '~ .tabContent .remark3').removeClass('remarkActive'); 33 $('.entranceMoreWraper' + index + '~ .tabContent .remark4').removeClass('remarkActive'); 34 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model1').addClass('activeBottomLine'); 35 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model2').removeClass('activeBottomLine'); 36 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model3').removeClass('activeBottomLine'); 37 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model4').removeClass('activeBottomLine'); 38 } else if (this.realIndex == 1) { 39 if (window.innerWidth < 750) { 40 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper').animate({ scrollLeft: 0 }, 800); 41 } 42 // $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper').scrollLeft(0); 43 $('.entranceMoreWraper' + index + '~ .tabContent .remark2').addClass('remarkActive'); 44 $('.entranceMoreWraper' + index + '~ .tabContent .remark1').removeClass('remarkActive'); 45 $('.entranceMoreWraper' + index + '~ .tabContent .remark3').removeClass('remarkActive'); 46 $('.entranceMoreWraper' + index + '~ .tabContent .remark4').removeClass('remarkActive'); 47 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model2').addClass('activeBottomLine'); 48 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model1').removeClass('activeBottomLine'); 49 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model3').removeClass('activeBottomLine'); 50 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model4').removeClass('activeBottomLine'); 51 } else if (this.realIndex == 2) { 52 if (window.innerWidth < 750) { 53 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper').animate({ scrollLeft: 340 }, 800); 54 } 55 // $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper').scrollLeft(240); 56 $('.entranceMoreWraper' + index + '~ .tabContent .remark3').addClass('remarkActive'); 57 $('.entranceMoreWraper' + index + '~ .tabContent .remark2').removeClass('remarkActive'); 58 $('.entranceMoreWraper' + index + '~ .tabContent .remark1').removeClass('remarkActive'); 59 $('.entranceMoreWraper' + index + '~ .tabContent .remark4').removeClass('remarkActive'); 60 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model3').addClass('activeBottomLine'); 61 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model1').removeClass('activeBottomLine'); 62 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model2').removeClass('activeBottomLine'); 63 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model4').removeClass('activeBottomLine'); 64 } else if (this.realIndex == 3) { 65 if (window.innerWidth < 750) { 66 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper').animate({ scrollLeft: 340 }, 800); 67 } 68 // $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper').scrollLeft(240); 69 $('.entranceMoreWraper' + index + '~ .tabContent .remark4').addClass('remarkActive'); 70 $('.entranceMoreWraper' + index + '~ .tabContent .remark2').removeClass('remarkActive'); 71 $('.entranceMoreWraper' + index + '~ .tabContent .remark3').removeClass('remarkActive'); 72 $('.entranceMoreWraper' + index + '~ .tabContent .remark1').removeClass('remarkActive'); 73 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model4').addClass('activeBottomLine'); 74 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model1').removeClass('activeBottomLine'); 75 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model2').removeClass('activeBottomLine'); 76 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model3').removeClass('activeBottomLine'); 77 } 78 }, 79 slideChangeTransitionStart: function() { 80 var currentSlide = null; 81 var currentVideo = null; 82 if(self[0].swiper.originalParams.loop) { 83 currentSlide = self[0].swiper.slides[self[0].swiper.realIndex + 1] 84 } else { 85 currentSlide = self[0].swiper.slides[self[0].swiper.realIndex]; 86 } 87 if (window.innerWidth < 750) { 88 currentVideo = currentSlide.querySelector('video.phs'); 89 } else { 90 currentVideo = currentSlide.querySelector('video.pcs'); 91 } 92 if (currentVideo && currentVideo.poster) { 93 self[0].swiper.autoplay.stop(); 94 if (window.innerWidth < 750) { 95 $(".swiper-slide-active video.phs")[0].currentTime = 0; 96 $(".swiper-slide-active video.phs")[0].play(); 97 $(".swiper-slide-active video.phs").on('ended',function(){ 98 self[0].swiper.autoplay.start(); 99 }); 100 } else { 101 $(".swiper-slide-active video.pcs")[0].currentTime = 0; 102 $(".swiper-slide-active video.pcs")[0].play(); 103 $(".swiper-slide-active video.pcs").on('ended',function(){ 104 self[0].swiper.autoplay.start(); 105 }); 106 } 107 } else { 108 self[0].swiper.autoplay.start(); 109 } 110 }, 111 } 112 });
113 }, 114 buildSwiper: function(index) { 115 var mySwiper8 = new Swiper('.entranceMoreWraper .entranceMoreWraper' + index, { 116 paginationClickable: true, 117 pagination:{ 118 el:'.entranceMoreWraper' + index + ' .swiper-pagination' 119 }, 120 navigation: { 121 nextEl: ".entranceMoreWraper" + index + " .swiper-button-next", 122 prevEl: ".entranceMoreWraper" + index + " .swiper-button-prev", 123 }, 124 speed:1000, 125 grabCursor:true, 126 loop: true, 127 autoplayDisableOnInteraction: false, 128 observer:true, 129 observeParents:true, 130 on: { 131 onSlideChangeEnd:function(swiper) { 132 swiper.update(); 133 } 134 } 135 }); 136 }, 137 allScrollImage: function(){ 138 var h = ($(window).scrollTop()) + $(window).height(); 139 // if (h >= ($('.toggleContentWraper').offset().top)) { 140 // $('.toggleContentWraper .swiper-wrapper img').addClass('restoreImg'); 141 // $('.toggleContentWraper .tabContent').addClass('universal-text'); 142 // $('.toggleContentWraper .tabContent').addClass('active'); 143 // } else { 144 // $('.toggleContentWraper .swiper-wrapper img').removeClass('restoreImg'); 145 // $('.toggleContentWraper .tabContent').removeClass('active'); 146 // $('.toggleContentWraper .tabContent').removeClass('universal-text'); 147 // } 148 // if (h >= ($('.toggleContentWraperP').offset().top)) { 149 // $('.toggleContentWraperP .swiper-wrapper img').addClass('restoreImg'); 150 // $('.toggleContentWraperP .tabContent').addClass('universal-text'); 151 // $('.toggleContentWraperP .tabContent').addClass('active'); 152 // } else { 153 // $('.toggleContentWraperP .swiper-wrapper img').removeClass('restoreImg'); 154 // $('.toggleContentWraperP .tabContent').removeClass('active'); 155 // $('.toggleContentWraperP .tabContent').removeClass('universal-text'); 156 // } 157 // if (h >= ($('.entranceMoreWraper .toggleContentWraper').offset().top)) { 158 // $('.entranceMoreWraper .toggleContentWraper .swiper-wrapper img').addClass('restoreImg'); 159 // $('.entranceMoreWraper .toggleContentWraper .tabContent').addClass('universal-text'); 160 // $('.entranceMoreWraper .toggleContentWraper .tabContent').addClass('active'); 161 // } else { 162 // $('.entranceMoreWraper .toggleContentWraper .swiper-wrapper img').removeClass('restoreImg'); 163 // $('.entranceMoreWraper .toggleContentWraper .tabContent').removeClass('active'); 164 // $('.entranceMoreWraper .toggleContentWraper .tabContent').removeClass('universal-text'); 165 // } 166 if(window.innerWidth < 750){ 167 if (h <= ($('.entranceMoreWraper').offset().top) || h >= ($('.entranceMoreWraper').offset().top) + window.innerHeight + $('.entranceMoreWraper').height() - 100) { 168 $('.entranceMoreWraper .closeButton').addClass('hideDiv'); 169 } else { 170 $('.entranceMoreWraper .closeButton').removeClass('hideDiv'); 171 } 172 } else { 173 if (h >= ($('.entranceMoreWraper').offset().top + $('.entranceMoreWraper').height() + window.innerHeight - 200) || h <= ($('.entranceMoreWraper').offset().top)) { 174 $('.entranceMoreWraper .closeButton').addClass('hideDiv'); 175 } else { 176 $('.entranceMoreWraper .closeButton').removeClass('hideDiv'); 177 } 178 } 179 }, 180 initOnePageLoad: function() { 181 $('.toggleContentWraper').addClass('toggleContentWraperP'); 182 var list2 = $('.entranceMoreWraper .toggleContentWraper'); 183 list2.each(function(index){ 184 if($(this).hasClass('toggleContentWraperP')){ 185 $(this).removeClass('toggleContentWraperP'); 186 } 187 }); 188 var list = $('.entranceMoreWraper .swiper-container'); 189 list.each(function(index){ 190 if ($(this).hasClass('swiperListContent')){ 191 $(this).addClass('listContentSpecial'); 192 $(this).addClass('entranceMoreWraper'+index); 193 $(this).removeClass('swiperListContent'); 194 } 195 if ($(this).hasClass('swiperListContentM')) { 196 $(this).addClass('entranceMoreWraper'+index); 197 $(this).removeClass('swiperListContentM'); 198 } 199 if ($(this).hasClass('swiperOnePage')) { 200 $(this).addClass('entranceMoreWraper'+index); 201 $(this).removeClass('swiperOnePage'); 202 } 203 if ($(this).hasClass('swiperToggleContent')) { 204 $(this).addClass('toggleSpecial'); 205 $(this).addClass('entranceMoreWraper'+index); 206 $(this).removeClass('swiperToggleContent'); 207 } 208 });
209 $('.entranceWraper .btnGroup .universal-btn').click(function(e) { 210 var list = $('.entranceMoreWraper .swiper-container'); 211 list.each(function(index){ 212 if ($(this).hasClass('swiperListContent')){ 213 $(this).addClass('listContentSpecial'); 214 $(this).addClass('entranceMoreWraper'+index); 215 $(this).removeClass('swiperListContent'); 216 } 217 if ($(this).hasClass('swiperListContentM')) { 218 $(this).addClass('entranceMoreWraper'+index); 219 $(this).removeClass('swiperListContentM'); 220 } 221 if ($(this).hasClass('swiperOnePage')) { 222 $(this).addClass('entranceMoreWraper'+index); 223 $(this).removeClass('swiperOnePage'); 224 } 225 if ($(this).hasClass('swiperToggleContent')) { 226 $(this).addClass('toggleSpecial'); 227 $(this).addClass('entranceMoreWraper'+index); 228 $(this).removeClass('swiperToggleContent'); 229 } 230 }); 231 e.preventDefault(); 232 $('.entranceWraper').addClass('hideDiv'); 233 $('.entranceMoreWraper .closeButton').removeClass('hideDiv'); 234 $(".entranceMoreWraperSpace").addClass('active'); 235 $(".entranceMoreWraper").addClass('showSecond'); 236 $(".entranceMoreWraper").removeClass('hideSecond'); 237 // $(".entranceMoreWraper").slideToggle(3000); 238 $(".entranceMoreWraper").each(function(index, item) { 239 var list = $('.entranceMoreWraper .swiper-container'); 240 list.each(function(index){ 241 if($(this).hasClass('entranceMoreWraper'+index) && !$(this).hasClass('toggleSpecial')){ 242 var name = 'swiperEntrance' + index; 243 name = new Swiper('.entranceMoreWraper'+index, { 244 paginationClickable: true, 245 spaceBetween:30, 246 pagination:{ 247 el:'.entranceMoreWraper' + index + ' .swiper-pagination' 248 }, 249 navigation: { 250 nextEl: ".entranceMoreWraper" + index + " .swiper-button-next", 251 prevEl: ".entranceMoreWraper" + index + " .swiper-button-prev", 252 }, 253 speed:1000, 254 grabCursor:true, 255 loop: true, 256 autoplayDisableOnInteraction: false, 257 observer:true, 258 observeParents:true, 259 on: { 260 onSlideChangeEnd:function(swiper) { 261 swiper.update(); 262 } 263 } 264 }); 265 if (name.originalParams.loop) { 266 if(name.slides.length - 2 <= 1) { 267 $('.entranceMoreWraper' + index + ' .swiper-pagination').addClass('hideDiv'); 268 $('.entranceMoreWraper' + index + ' .swiper-button-prev').addClass('hideDiv'); 269 $('.entranceMoreWraper' + index + ' .swiper-button-next').addClass('hideDiv'); 270 name.destroy(); 271 } 272 } else { 273 if(name.slides.length <= 1) { 274 $('.entranceMoreWraper' + index + ' .swiper-pagination').addClass('hideDiv'); 275 $('.entranceMoreWraper' + index + ' .swiper-button-prev').addClass('hideDiv'); 276 $('.entranceMoreWraper' + index + ' .swiper-button-next').addClass('hideDiv'); 277 name.destroy(); 278 } 279 } 280 } else if ($(this).hasClass('entranceMoreWraper'+index) && $(this).hasClass('toggleSpecial')) { 281 var self = $(this); 282 var autoTime = self.attr('interval-time'); 283 var slidesCount = self.attr('swiper-length'); 284 var name = 'swiperEntrance' + index; 285 name = new Swiper('.entranceMoreWraper'+index, { 286 loop: true, 287 autoplay: autoTime == 0 || autoTime == '' ? false : { delay: autoTime,disableOnInteraction:false }, 288 slideToClickedSlide:true, 289 autoplayDisableOnInteraction: false, 290 observer:true, 291 effect: 'fade', 292 speed: 1000, 293 observeParents:true, 294 on: { 295 init: function() { 296 if (autoTime == 0 || autoTime == '') { 297 this.autoplay = false; 298 } else { 299 this.autoplay.delay = autoTime; 300 this.autoplay.disableOnInteraction = false; 301 } 302 }, 303 slideChange: function() { 304 if(this.realIndex == 0) { 305 if (window.innerWidth < 750) { 306 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper').animate({ scrollLeft: 0 }, 800); 307 } 308 // $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper').scrollLeft(0); 309 $('.entranceMoreWraper' + index + '~ .tabContent .remark1').addClass('remarkActive'); 310 $('.entranceMoreWraper' + index + '~ .tabContent .remark2').removeClass('remarkActive'); 311 $('.entranceMoreWraper' + index + '~ .tabContent .remark3').removeClass('remarkActive'); 312 $('.entranceMoreWraper' + index + '~ .tabContent .remark4').removeClass('remarkActive'); 313 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model1').addClass('activeBottomLine'); 314 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model2').removeClass('activeBottomLine'); 315 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model3').removeClass('activeBottomLine'); 316 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model4').removeClass('activeBottomLine'); 317 } else if (this.realIndex == 1) { 318 if (window.innerWidth < 750) { 319 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper').animate({ scrollLeft: 0 }, 800); 320 } 321 // $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper').scrollLeft(0); 322 $('.entranceMoreWraper' + index + '~ .tabContent .remark2').addClass('remarkActive'); 323 $('.entranceMoreWraper' + index + '~ .tabContent .remark1').removeClass('remarkActive'); 324 $('.entranceMoreWraper' + index + '~ .tabContent .remark3').removeClass('remarkActive'); 325 $('.entranceMoreWraper' + index + '~ .tabContent .remark4').removeClass('remarkActive'); 326 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model2').addClass('activeBottomLine'); 327 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model1').removeClass('activeBottomLine'); 328 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model3').removeClass('activeBottomLine'); 329 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model4').removeClass('activeBottomLine'); 330 } else if (this.realIndex == 2) { 331 if (window.innerWidth < 750) { 332 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper').animate({ scrollLeft: 340 }, 800); 333 } 334 // $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper').scrollLeft(240); 335 $('.entranceMoreWraper' + index + '~ .tabContent .remark3').addClass('remarkActive'); 336 $('.entranceMoreWraper' + index + '~ .tabContent .remark2').removeClass('remarkActive'); 337 $('.entranceMoreWraper' + index + '~ .tabContent .remark1').removeClass('remarkActive'); 338 $('.entranceMoreWraper' + index + '~ .tabContent .remark4').removeClass('remarkActive'); 339 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model3').addClass('activeBottomLine'); 340 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model1').removeClass('activeBottomLine'); 341 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model2').removeClass('activeBottomLine'); 342 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model4').removeClass('activeBottomLine'); 343 } else if (this.realIndex == 3) { 344 if (window.innerWidth < 750) { 345 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper').animate({ scrollLeft: 340 }, 800); 346 } 347 // $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper').scrollLeft(240); 348 $('.entranceMoreWraper' + index + '~ .tabContent .remark4').addClass('remarkActive'); 349 $('.entranceMoreWraper' + index + '~ .tabContent .remark2').removeClass('remarkActive'); 350 $('.entranceMoreWraper' + index + '~ .tabContent .remark3').removeClass('remarkActive'); 351 $('.entranceMoreWraper' + index + '~ .tabContent .remark1').removeClass('remarkActive'); 352 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model4').addClass('activeBottomLine'); 353 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model1').removeClass('activeBottomLine'); 354 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model2').removeClass('activeBottomLine'); 355 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .model3').removeClass('activeBottomLine'); 356 } 357 }, 358 slideChangeTransitionStart: function() { 359 var currentSlide = null; 360 var currentVideo = null; 361 if(self[0].swiper.originalParams.loop) { 362 currentSlide = self[0].swiper.slides[self[0].swiper.realIndex + 1] 363 } else { 364 currentSlide = self[0].swiper.slides[self[0].swiper.realIndex]; 365 } 366 if (window.innerWidth < 750) { 367 currentVideo = currentSlide.querySelector('video.phs'); 368 } else { 369 currentVideo = currentSlide.querySelector('video.pcs'); 370 } 371 if (currentVideo && currentVideo.poster) { 372 self[0].swiper.autoplay.stop(); 373 if (window.innerWidth < 750) { 374 $(".swiper-slide-active video.phs")[0].currentTime = 0; 375 $(".swiper-slide-active video.phs")[0].play(); 376 $(".swiper-slide-active video.phs").on('ended',function(){ 377 self[0].swiper.autoplay.start(); 378 }); 379 } else { 380 $(".swiper-slide-active video.pcs")[0].currentTime = 0; 381 $(".swiper-slide-active video.pcs")[0].play(); 382 $(".swiper-slide-active video.pcs").on('ended',function(){ 383 self[0].swiper.autoplay.start(); 384 }); 385 } 386 } else { 387 self[0].swiper.autoplay.start(); 388 } 389 }, 390 } 391 }); 392 //ç¹å»äºä»¶ 393 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .slide1').click(function(e) { 394 e.preventDefault(); 395 if(name.destroyed) { 396 methodsAll.swiperToggleContentBuild(name,index); 397 name.slideTo(1); 398 } else { 399 name.slideTo(1); 400 } 401 }); 402 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .slide2').click(function(e) { 403 e.preventDefault(); 404 if(name.destroyed) { 405 methodsAll.swiperToggleContentBuild(name,index); 406 name.slideTo(2); 407 } else { 408 name.slideTo(2); 409 } 410 }); 411 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .slide3').
411click(function(e) { 412 e.preventDefault(); 413 if(name.destroyed) { 414 methodsAll.swiperToggleContentBuild(name,index); 415 name.slideTo(3); 416 } else { 417 name.slideTo(3); 418 } 419 }); 420 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .slide4').click(function(e) { 421 e.preventDefault(); 422 if(name.destroyed) { 423 methodsAll.swiperToggleContentBuild(name,index); 424 name.slideTo(4); 425 } else { 426 name.slideTo(4); 427 } 428 }); 429 //hoveräºä»¶ 430 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .slide1').hover(function(e) { 431 if(name.destroyed) { 432 methodsAll.swiperToggleContentBuild(name,index); 433 name.slideTo(1); 434 } else { 435 name.slideTo(1); 436 } 437 }); 438 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .slide2').hover(function() { 439 if(name.destroyed) { 440 methodsAll.swiperToggleContentBuild(name,index); 441 name.slideTo(2); 442 } else { 443 name.slideTo(2); 444 } 445 }); 446 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .slide3').hover(function() { 447 if(name.destroyed) { 448 methodsAll.swiperToggleContentBuild(name,index); 449 name.slideTo(3); 450 } else { 451 name.slideTo(3); 452 } 453 }); 454 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .slide4').hover(function() { 455 if(name.destroyed) { 456 methodsAll.swiperToggleContentBuild(name,index); 457 name.slideTo(4); 458 } else { 459 name.slideTo(4); 460 } 461 }); 462 if(slidesCount == 1) { 463 if (window.innerWidth < 750) { 464 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper').addClass('contentCenter'); 465 } 466 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .slide2').addClass('hideDiv'); 467 $('.entranceMoreWraper' + index + '~ .tabContent .remark2').addClass('hideDiv'); 468 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .slide3').addClass('hideDiv'); 469 $('.entranceMoreWraper' + index + '~ .tabContent .remark3').addClass('hideDiv'); 470 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .slide4').addClass('hideDiv'); 471 $('.entranceMoreWraper' + index + '~ .tabContent .remark4').addClass('hideDiv'); 472 name.destroy(); 473 } 474 else if (slidesCount == 2) { 475 if (window.innerWidth < 750) { 476 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper').addClass('contentCenter'); 477 } 478 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .slide3').addClass('hideDiv'); 479 $('.entranceMoreWraper' + index + '~ .tabContent .remark3').addClass('hideDiv'); 480 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .slide4').addClass('hideDiv'); 481 $('.entranceMoreWraper' + index + '~ .tabContent .remark4').addClass('hideDiv'); 482 } else if (slidesCount == 3) { 483 $('.entranceMoreWraper' + index + '~ .tabContent .contentWrapper .slide4').addClass('hideDiv'); 484 $('.entranceMoreWraper' + index + '~ .tabContent .remark4').addClass('hideDiv'); 485 } 486 } 487 }) 488 }); 489 }); 490 $('.entranceMoreWraper .closeButton').click(function(e) { 491 e.preventDefault(); 492 // $(".entranceMoreWraper").slideToggle(10); 493 $('.entranceMoreWraper .closeButton').addClass('hideDiv'); 494 $(".entranceMoreWraper").addClass('hideSecond'); 495 $(".entranceMoreWraperSpace").removeClass('active'); 496 $(".entranceMoreWraper").removeClass('showSecond'); 497 $('.entranceWraper').removeClass('hideDiv'); 498 var initPosition = $('.entranceWraper').offset(); 499 initPosition.top = initPosition.top - 40; 500 $('html, body').animate({scrollTop: initPosition.top}, 0); 501 // setTimeout(function(){ 502 // $('.entranceWraper').removeClass('hideDiv'); 503 // var initPosition = $('.entranceWraper')?.offset(); 504 // initPosition.top = initPosition?.top - 40; 505 // $('html, body').animate({scrollTop: initPosition.top}, 0); 506 // },0); 507 }); 508 }, 509 allLoad: function(){ 510 $('.toggleContentWraper').addClass('toggleContentWraperP'); 511 var list1 = $('.entranceMoreWraper .toggleContentWraper'); 512 list1.each(function(index){ 513 if($(this).hasClass('toggleContentWraperP')){ 514 $(this).removeClass('toggleContentWraperP'); 515 } 516 });
517 518 // var list = $('.entranceMoreWraper .swiper-container'); 519 // list.each(function(index){ 520 // if ($(this).hasClass('swiperListContent')){ 521 // $(this).addClass('listContentSpecial'); 522 // $(this).addClass('entranceMoreWraper'+index); 523 // $(this).removeClass('swiperListContent'); 524 // } 525 // if ($(this).hasClass('swiperListContentM')) { 526 // $(this).addClass('entranceMoreWraper'+index); 527 // $(this).removeClass('swiperListContentM'); 528 // } 529 // if ($(this).hasClass('swiperOnePage')) { 530 // $(this).addClass('entranceMoreWraper'+index); 531 // $(this).removeClass('swiperOnePage'); 532 // } 533 // if ($(this).hasClass('swiperToggleContent')) { 534 // $(this).addClass('toggleSpecial'); 535 // $(this).addClass('entranceMoreWraper'+index); 536 // $(this).removeClass('swiperToggleContent'); 537 // } 538 // }); 539 $(".swiperListContent").each(function(index, item) { 540 if (window.innerWidth <= 750) return false; 541 var $this = $(item).get(0); 542 var $slides = $($this).find('.swiper-slide'); 543 var $paginationEl = $($this).find('.swiper-pagination').get(0); 544 var $prevEl = $($this).find('.swiper-button-prev').get(0); 545 var $nextEl = $($this).find('.swiper-button-next').get(0); 546 new Swiper($this, { 547 paginationClickable: true, 548 pagination:{ 549 el: $paginationEl, 550 }, 551 navigation: { 552 prevEl: $prevEl, 553 nextEl: $nextEl, 554 }, 555 speed: 1000, 556 grabCursor: true, 557 loop: $slides.length > 1 ? true : false, 558 touchEventsTarget: 'wrapper', 559 autoplayDisableOnInteraction: false, 560 observer: true, 561 observeParents: true, 562 }); 563 var $swiperThis = $this.swiper; 564 if($swiperThis && $swiperThis.originalParams) { 565 if ($swiperThis.originalParams.loop) { 566 if($swiperThis.slides.length - 2 <= 1) { 567 $($paginationEl).addClass('hideDiv'); 568 $($prevEl).addClass('hideDiv'); 569 $($nextEl).addClass('hideDiv'); 570 $swiperThis.destroy(); 571 } 572 } else { 573 if($swiperThis.slides.length <= 1) { 574 $($paginationEl).addClass('hideDiv'); 575 $($prevEl).addClass('hideDiv'); 576 $($nextEl).addClass('hideDiv'); 577 $swiperThis.destroy(); 578 } 579 } 580 } 581 }); 582 $(".swiperOnePage").each(function(index, item) { 583 var mySwiper4 = new Swiper('.swiperOnePage', { 584 paginationClickable: true, 585 spaceBetween:30, 586 pagination:{ 587 el:'.swiperOnePage .swiper-pagination' 588 }, 589 navigation: { 590 nextEl: ".swiperOnePage .swiper-button-next", 591 prevEl: ".swiperOnePage .swiper-button-prev", 592 }, 593 lazy: { 594 loadPrevNext: true, 595 }, 596 speed:1000, 597 grabCursor:true, 598 loop:true, 599 autoplayDisableOnInteraction: false, 600 observer:true, 601 observeParents:true, 602 on: { 603 onSlideChangeEnd: function(swiper) { 604 swiper.update(); 605 }, 606 } 607 }); 608 if(mySwiper4.originalParams){ 609 if (mySwiper4.originalParams.loop) { 610 if(mySwiper4.slides.length - 2 <= 1) { 611 $('.swiperOnePage .placeHolderM').addClass('hideDiv'); 612 $('.swiperOnePage .swiper-pagination').addClass('hideDiv'); 613 $('.swiperOnePage .swiper-button-prev').addClass('hideDiv'); 614 $('.swiperOnePage .swiper-button-next').addClass('hideDiv'); 615 mySwiper4.destroy(); 616 } 617 } else { 618 if(mySwiper4.slides.length <= 1) { 619 $('.swiperOnePage .placeHolderM').addClass('hideDiv'); 620 $('.swiperOnePage .swiper-pagination').addClass('hideDiv'); 621 $('.swiperOnePage .swiper-button-prev').addClass('hideDiv'); 622 $('.swiperOnePage .swiper-button-next').addClass('hideDiv'); 623 mySwiper4.destroy(); 624 } 625 } 626 } 627 }); 628 $(".swiperListContentM").each(function(index, item) { 629 if (window.innerWidth > 750) return false; 630 var $this = $(item).get(0); 631 var $slides = $($this).find('.swiper-slide'); 632 var $paginationEl = $($this).find('.swiper-pagination').get(0); 633 new Swiper($this, { 634 paginationClickable: true, 635 spaceBetween: 30, 636 pagination:{ 637 el: $paginationEl, 638 }, 639 speed: 1000, 640 grabCursor: true, 641 loop: $slides.length > 1 ? true : false, 642 autoplayDisableOnInteraction: false, 643 observer: true, 644 observeParents: true, 645 on: { 646 onSlideChangeEnd: function(swiper) {
647 swiper.update(); 648 }, 649 } 650 }); 651 var $swiperThis = $this.swiper; 652 if($swiperThis && $swiperThis.originalParams) { 653 if ($swiperThis.originalParams.loop) { 654 if($swiperThis.slides.length - 2 <= 1) { 655 $($paginationEl).addClass('hideDiv'); 656 $swiperThis.destroy(); 657 } 658 } else { 659 if ($swiperThis.slides.length <= 1) { 660 $($paginationEl).addClass('hideDiv'); 661 $swiperThis.destroy(); 662 } 663 } 664 } 665 }); 666 $(".swiperToggleContent").each(function(index, item) { 667 var self = $(this); 668 if(!$(self[0]).parent().hasClass('toggleContentWraperP')) {return;} 669 var autoTime = self.attr('interval-time'); 670 var slidesCount = self.attr('swiper-length'); 671 var nameFirst = 'swiperToggleFirst' + index; 672 nameFirst = new Swiper(this, { 673 loop: true, 674 autoplay: false, 675 slideToClickedSlide:true, 676 autoplayDisableOnInteraction: false, 677 observer:true, 678 speed: 1000, 679 effect: 'fade', 680 observeParents:true, 681 on: { 682 init: function() { 683 if (autoTime == 0 || autoTime == '') { 684 this.autoplay = false; 685 } else { 686 this.autoplay.delay = autoTime; 687 this.autoplay.disableOnInteraction = false; 688 } 689 }, 690 slideChange: function() { 691 if (self[0].parentNode) { // 692 if(this.realIndex == 0) { 693 694 if (window.innerWidth < 750) { 695 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper').animate({ scrollLeft: 0 }, 800); 696 } 697 // $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper').scrollLeft(0); 698 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .remark1').addClass('remarkActive'); 699 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .remark2').removeClass('remarkActive'); 700 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .remark3').removeClass('remarkActive'); 701 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .remark4').removeClass('remarkActive'); 702 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper .model1').addClass('activeBottomLine'); 703 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper .model2').removeClass('activeBottomLine'); 704 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper .model3').removeClass('activeBottomLine'); 705 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper .model4').removeClass('activeBottomLine'); 706 } else if (this.realIndex == 1) { 707 if (window.innerWidth < 750) { 708 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper').animate({ scrollLeft: 0 }, 800); 709 } 710 // $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper').scrollLeft(0); 711 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .remark2').addClass('remarkActive'); 712 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .remark1').removeClass('remarkActive'); 713 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .remark3').removeClass('remarkActive'); 714 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .remark4').removeClass('remarkActive'); 715 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper .model2').addClass('activeBottomLine'); 716 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper .model1').removeClass('activeBottomLine'); 717 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper .model3').removeClass('activeBottomLine'); 718 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper .model4').removeClass('activeBottomLine'); 719 }else if (this.realIndex == 2) { 720 if (window.innerWidth < 750) { 721 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper').animate({ scrollLeft: 340 }, 800); 722 } 723 // $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper').scrollLeft(240); 724 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .remark3').addClass('remarkActive'); 725 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .remark2').removeClass('remarkActive'); 726 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .remark1').removeClass('remarkActive'); 727 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .remark4').removeClass('remarkActive'); 728 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper .model3').addClass('activeBottomLine'); 729 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper .model1').removeClass('activeBottomLine'); 730 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper .model2').removeClass('activeBottomLine'); 731 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper .model4').removeClass('activeBottomLine'); 732 } else if (this.realIndex == 3) { 733 if (window.innerWidth < 750) { 734 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper').animate({ scrollLeft: 340 }, 800); 735 } 736 // $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper').scrollLeft(240); 737 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .remark4').addClass('remarkActive'); 738 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .remark2').removeClass('remarkActive'); 739 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .remark3').removeClass('remarkActive'); 740 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .remark1').removeClass('remarkActive'); 741 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper .model4').addClass('activeBottomLine'); 742 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper .model1').removeClass('activeBottomLine'); 743 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper .model2').removeClass('activeBottomLine'); 744 $(self[0]).parent('.toggleContentWraperP').find(' .tabContent .contentWrapper .model3').removeClass('activeBottomLine'); 745 } 746 } // 747 }, 748 slideChangeTransitionStart: function() { 749 var currentSlide = null; 750 var currentVideo = null; 751 if(self[0].swiper.originalParams.loop) { 752 currentSlide = self[0].swiper.slides[self[0].swiper.realIndex + 1] 753 } else { 754 currentSlide = self[0].swiper.slides[self[0].swiper.realIndex]; 755 } 756 if (window.innerWidth < 750) { 757 currentVideo = currentSlide.querySelector('video.phs'); 758 } else { 759 currentVideo = currentSlide.querySelector('video.pcs'); 760 } 761 if (currentVideo && currentVideo.poster) { 762 self[0].swiper.autoplay.stop(); 763 if (window.innerWidth < 750) { 764 if($(".swiper-slide-active video.phs")[0]){ 765 $(".swiper-slide-active video.phs")[0].currentTime = 0; 766 $(".swiper-slide-active video.phs")[0].play(); 767 $(".swiper-slide-active video.phs").on('ended',function(){ 768 self[0].swiper.autoplay.start(); 769 }); 770 } 771 } else { 772 if($(".swiper-slide-active video.pcs")[0]){ 773 $(".swiper-slide-active video.pcs")[0].currentTime = 0; 774 $(".swiper-slide-active video.pcs")[0].play(); 775 $(".swiper-slide-active video.pcs").on('ended',function(){ 776 self[0].swiper.autoplay.start(); 777 }); 778 } 779 } 780 } else { 781 self[0].swiper.autoplay.start(); 782 } 783 }, 784 } 785 }); 786 //ç¹å»äºä»¶ 787 $('.toggleContentWraperP .tabContent .contentWrapper .slide1').click(function(e) { 788 e.preventDefault(); 789 if(nameFirst.destroyed) { 790 methodsAll.swiperToggleContentBuild(); 791 nameFirst.slideTo(1); 792 } else { 793 nameFirst.slideTo(1); 794 } 795 }); 796 $('.toggleContentWraperP .tabContent .contentWrapper .slide2').click(function(e) { 797 e.preventDefault(); 798 if(nameFirst.destroyed) { 799 methodsAll.swiperToggleContentBuild(); 800 nameFirst.slideTo(2); 801 } else { 802 nameFirst.slideTo(2); 803 } 804 }); 805 $('.toggleContentWraperP .tabContent .contentWrapper .slide3').
805click(function(e) { 806 e.preventDefault(); 807 if(nameFirst.destroyed) { 808 methodsAll.swiperToggleContentBuild(); 809 nameFirst.slideTo(3); 810 } else { 811 nameFirst.slideTo(3); 812 } 813 }); 814 $('.toggleContentWraperP .tabContent .contentWrapper .slide4').click(function(e) { 815 e.preventDefault(); 816 if(nameFirst.destroyed) { 817 methodsAll.swiperToggleContentBuild(); 818 nameFirst.slideTo(4); 819 } else { 820 nameFirst.slideTo(4); 821 } 822 }); 823 //hoveräºä»¶ 824 $('.toggleContentWraperP .tabContent .contentWrapper .slide1').hover(function(e) { 825 if(nameFirst.destroyed) { 826 methodsAll.swiperToggleContentBuild(); 827 nameFirst.slideTo(1); 828 } else { 829 nameFirst.slideTo(1); 830 } 831 }); 832 $('.toggleContentWraperP .tabContent .contentWrapper .slide2').hover(function() { 833 if(nameFirst.destroyed) { 834 methodsAll.swiperToggleContentBuild(); 835 nameFirst.slideTo(2); 836 } else { 837 nameFirst.slideTo(2); 838 } 839 }); 840 $('.toggleContentWraperP .tabContent .contentWrapper .slide3').hover(function() { 841 if(nameFirst.destroyed) { 842 methodsAll.swiperToggleContentBuild(); 843 nameFirst.slideTo(3); 844 } else { 845 nameFirst.slideTo(3); 846 } 847 }); 848 $('.toggleContentWraperP .tabContent .contentWrapper .slide4').hover(function() { 849 if(nameFirst.destroyed) { 850 methodsAll.swiperToggleContentBuild(); 851 nameFirst.slideTo(4); 852 } else { 853 nameFirst.slideTo(4); 854 } 855 }); 856 if(slidesCount == 1) { 857 if (window.innerWidth < 750) { 858 $('.toggleContentWraperP .tabContent .contentWrapper').addClass('contentCenter'); 859 } 860 $('.toggleContentWraperP .tabContent .contentWrapper .slide2').addClass('hideDiv'); 861 $('.toggleContentWraperP .tabContent .remark2').addClass('hideDiv'); 862 $('.toggleContentWraperP .tabContent .contentWrapper .slide3').addClass('hideDiv'); 863 $('.toggleContentWraperP .tabContent .remark3').addClass('hideDiv'); 864 $('.toggleContentWraperP .tabContent .contentWrapper .slide4').addClass('hideDiv'); 865 $('.toggleContentWraperP .tabContent .remark4').addClass('hideDiv'); 866 nameFirst.destroy(); 867 } 868 else if (slidesCount == 2) { 869 if (window.innerWidth < 750) { 870 $('.toggleContentWraperP .tabContent .contentWrapper').addClass('contentCenter'); 871 } 872 $('.toggleContentWraperP .tabContent .contentWrapper .slide3').addClass('hideDiv'); 873 $('.toggleContentWraperP .tabContent .remark3').addClass('hideDiv'); 874 $('.toggleContentWraperP .tabContent .contentWrapper .slide4').addClass('hideDiv'); 875 $('.toggleContentWraperP .tabContent .remark4').addClass('hideDiv'); 876 } else if (slidesCount == 3) { 877 $('.toggleContentWraperP .tabContent .contentWrapper .slide4').addClass('hideDiv'); 878 $('.toggleContentWraperP .tabContent .remark4').addClass('hideDiv'); 879 } 880 }); 881 //init 882 $('.toggleContentWraper .tabContent .contentWrapper .slide1 .model1').addClass('bottomLine'); 883 $('.toggleContentWraper .tabContent .contentWrapper .slide2 .model2').addClass('bottomLine'); 884 $('.toggleContentWraper .tabContent .contentWrapper .slide3 .model3').addClass('bottomLine'); 885 $('.toggleContentWraper .tabContent .contentWrapper .slide4 .model4').addClass('bottomLine'); 886 887 $('.toggleContentWraper .tabContent .contentWrapper .slide1 .model1').addClass('activeBottomLine'); 888 $('.toggleContentWraper .tabContent .contentWrapper .slide2 .model2').removeClass('activeBottomLine'); 889 $('.toggleContentWraper .tabContent .contentWrapper .slide3 .model3').removeClass('activeBottomLine'); 890 $('.toggleContentWraper .tabContent .contentWrapper .slide4 .model4').removeClass('activeBottomLine'); 891 $('.toggleContentWraper .tabContent .remark1').addClass('remarkActive'); 892 $('.toggleContentWraper .tabContent .remark2').removeClass('remarkActive'); 893 $('.toggleContentWraper .tabContent .remark3').removeClass('remarkActive'); 894 $('.toggleContentWraper .tabContent .remark4').removeClass('remarkActive'); 895 //hoveräºä»¶ 896 $('.toggleContentWraper .tabContent .contentWrapper .slide1').hover(function(e) { 897 $(this).parents('.contentWrapper').find('.slide1 .model1').addClass('activeBottomLine'); 898 $(this).parents('.contentWrapper').find('.slide2 .model2').removeClass('activeBottomLine'); 899 $(this).parents('.contentWrapper').find('.slide3 .model3').removeClass('activeBottomLine'); 900 $(this).parents('.contentWrapper').find('.slide4 .model4').removeClass('activeBottomLine'); 901 $(this).parents('.tabContent').find('.remark1').addClass('remarkActive'); 902 $(this).parents('.tabContent').find('.remark2').removeClass('remarkActive'); 903 $(this).parents('.tabContent').find('.remark3').removeClass('remarkActive'); 904 $(this).parents('.tabContent').find('.remark4').removeClass('remarkActive'); 905 }); 906 $('.toggleContentWraper .tabContent .contentWrapper .slide2').hover(function() { 907 $(this).parents('.contentWrapper').find('.slide2 .model2').addClass('activeBottomLine'); 908 $(this).parents('.contentWrapper').find('.slide1 .model1').removeClass('activeBottomLine'); 909 $(this).parents('.contentWrapper').find('.slide3 .model3').removeClass('activeBottomLine'); 910 $(this).parents('.contentWrapper').find('.slide4 .model4').removeClass('activeBottomLine'); 911 $(this).parents('.tabContent').find('.remark2').addClass('remarkActive'); 912 $(this).parents('.tabContent').find('.remark1').removeClass('remarkActive'); 913 $(this).parents('.tabContent').find('.remark3').removeClass('remarkActive'); 914 $(this).parents('.tabContent').find('.remark4').removeClass('remarkActive'); 915 }); 916 $('.toggleContentWraper .tabContent .contentWrapper .slide3').hover(function() { 917 $(this).parents('.contentWrapper').find('.slide3 .model3').addClass('activeBottomLine'); 918 $(this).parents('.contentWrapper').find('.slide2 .model2').removeClass('activeBottomLine'); 919 $(this).parents('.contentWrapper').find('.slide1 .model1').removeClass('activeBottomLine'); 920 $(this).parents('.contentWrapper').find('.slide4 .model4').removeClass('activeBottomLine'); 921 $(this).parents('.tabContent').find('.remark3').addClass('remarkActive'); 922 $(this).parents('.tabContent').find('.remark2').removeClass('remarkActive'); 923 $(this).parents('.tabContent').find('.remark1').removeClass('remarkActive'); 924 $(this).parents('.tabContent').find('.remark4').removeClass('remarkActive'); 925 }); 926 $('.toggleContentWraper .tabContent .contentWrapper .slide4').hover(function() { 927 $(this).parents('.contentWrapper').find('.slide4 .model4').addClass('activeBottomLine'); 928 $(this).parents('.contentWrapper').find('.slide2 .model2').removeClass('activeBottomLine'); 929 $(this).parents('.contentWrapper').find('.slide3 .model3').removeClass('activeBottomLine'); 930 $(this).parents('.contentWrapper').find('.slide1 .model1').removeClass('activeBottomLine'); 931 $(this).parents('.tabContent').find('.remark4').addClass('remarkActive'); 932 $(this).parents('.tabContent').find('.remark2').removeClass('remarkActive'); 933 $(this).parents('.tabContent').find('.remark3').removeClass('remarkActive'); 934 $(this).parents('.tabContent').find('.remark1').removeClass('remarkActive'); 935 }); 936 }, 937 loadMoreModel: function(){ 938 $('.entranceWraper .btnGroup').click(function(){ 939 if(window.innerWidth>750){ 940 $('html').css({'overflow':'hidden','padding-right':'8px'}) 941 setTimeout(function(){ 942 $('html').css({'overflow':'auto','padding-right':'0px'}) 943 },1000) 944 } 945 universalMethods.scrollImage(); 946 universalMethods.universalKvPosition(); 947 universalMethods.universalDividerSMagic(); 948 universalMethods.kvDetailAnimation(); 949 $(".universalKv-detail").show(); 950 $(".universalKv").removeClass('active') 951 }) 952 } 953} 954/* 955 .universalSwiper éç¨swiperçclass,æ¯æè§é¢&å¾ç 956*/ 957var universalMethods = { 958 scollDiasbled: false, 959 winWidth: window.innerWidth, 960 winHeight: window.innerHeight, 961 winScrolling: false, 962 winScrollTop: 0, 963 isMobile: window.innerWidth > 750 ? false : true, 964 kvLength: 0, 965 startY: null, 966 swiperData: null, 967 prevScrollPos: 0, 968 beforeActive: false, 969 beforeActiveIndex: null, 970 menuClickStatus: false, 971 windowScrollHeader: function () { 972 if(universalMethods.winScrolling){return false} 973 var currentScrollPos = $(window).scrollTop(); 974 var tolerance = $('.universalSubHeader').height() ? $('.universalSubHeader').height() * 0.8 : 5; // æ·»å ç容差 975 // éåæ¯ä¸ªæ¨¡åï¼æ£æ¥æ¯å¦æ»å¨å°å¯è§åºå 976 $('.menuLink').each(function() { 977 var menuLinkTop = $(this).offset().top; 978 var menuLinkHeight = $(this).outerHeight(); 979 // 使ç¨å®¹å·®èå´è¿è¡æ¯è¾ 980 if (currentScrollPos >= (menuLinkTop - tolerance) && currentScrollPos < (menuLinkTop + menuLinkHeight - tolerance)) { 981 // é«äº®å¯¹åºç导èªèå项 982 var targetMenuItem = $('.universalSubHeader .menu a[href="' + '#' + $(this).attr('id') + '"]'); 983 if (targetMenuItem.length) { 984 universalMethods.beforeActive = false 985 universalMethods.beforeActiveIndex = null 986 $('.universalSubHeader .menu a').removeClass('active'); 987 targetMenuItem.addClass('active'); 988 } 989 } 990 if (currentScrollPos < universalMethods.prevScrollPos ) { //䏿» 991 var activeId = $('.universalSubHeader .menu .active').attr('href'); 992 if(activeId){ 993 var activeDom = $(activeId); 994 var activeTop = activeDom.offset().top; 995 var activeIndex = $('.universalSubHeader .menu .active').index(); 996 // 使ç¨å®¹å·®èå´å¤ææ»åº 997 if (currentScrollPos < (activeTop - tolerance) && universalMethods.beforeActive === false && activeIndex != universalMethods.beforeActiveIndex) { //æ»åºæ¨¡å 998 universalMethods.beforeActive = true 999 $('.universalSubHeader .menu a').removeClass('active'); 1000 if(activeIndex!==0){ 1001 universalMethods.beforeActiveIndex = activeIndex-1 1002 $('.universalSubHeader .menu a').eq(activeIndex-1).addClass('active'); 1003 } 1004 } 1005 } 1006 } 1007 }) 1008 universalMethods.prevScrollPos = currentScrollPos; 1009 }, 1010 universalBuildSwiper: function () { 1011 $(".universalSwiper").each(function(index, item) { 1012 var self = $(this); 1013 var selfSwiper = self.find('.swiper-container')[0]; 1014 var selfLength = self.attr('swiper-length'); 1015 if(self.hasClass('universalKv')){ 1016 universalMethods.kvLength ++ 1017 } 1018 if (!selfSwiper.swiper && selfLength > 1&& !self.hasClass('universalDivider')) { 1019 universalMethods.swiperData = new Swiper(selfSwiper, { 1020 loop: true,
1021 speed: 800, 1022 autoplay: { 1023 delay: 4500, 1024 disableOnInteraction: false, 1025 }, 1026 pagination: { 1027 el: '.swiper-pagination', 1028 }, 1029 navigation: { 1030 nextEl: ".swiper-button-next", 1031 prevEl: ".swiper-button-prev", 1032 }, 1033 on: { 1034 init: function () { 1035 var $swiperThis = this; 1036 self.find('.universalKv-detail').removeClass('active'); 1037 }, 1038 slideChangeTransitionStart: function () { 1039 var that = this; 1040 self.find('.swiper-slide-active').find('.universalKv-detail').css('opacity',0).removeClass('active'); 1041 self.find('.swiper-slide-duplicate-active').find('.universalKv-detail').css('opacity',0).removeClass('active'); 1042 setTimeout(function(){ 1043 self.find('.swiper-slide-active').find('.universalKv-detail').css('opacity',1).addClass('active'); 1044 self.find('.swiper-slide-duplicate-active').find('.universalKv-detail').css('opacity',1).addClass('active'); 1045 setTimeout(function(){ 1046 self.find('.swiper-slide-next').find('.universalKv-detail').removeClass('active'); 1047 self.find('.swiper-slide-duplicate-next').find('.universalKv-detail').removeClass('active'); 1048 self.find('.swiper-slide-prev').find('.universalKv-detail').removeClass('active'); 1049 self.find('.swiper-slide-duplicate-prev').find('.universalKv-detail').removeClass('active'); 1050 },10) 1051 },500) 1052 }, 1053 slideChangeTransitionEnd: function () { 1054 var previousSlide = this.slides[this.previousIndex]; 1055 var currentSlide = this.slides[this.activeIndex]; 1056 var previousVideo; 1057 var currentVideo; 1058 if(previousSlide){ 1059 previousVideo = previousSlide.querySelector('video'); 1060 } 1061 if(currentSlide){ 1062 currentVideo = currentSlide.querySelector('video'); 1063 } 1064 if (previousVideo) { 1065 previousVideo.pause(); 1066 } 1067 1068 if (currentVideo) { 1069 currentVideo.play(); 1070 } 1071 } 1072 } 1073 }); 1074 } 1075 if (selfLength == 1&& !self.hasClass('universalDivider')) { 1076 self.find('.swiper-button').remove() 1077 } 1078 }); 1079 }, 1080 universalKvPosition: function() { 1081 $(".universalKv").each(function(index, item) { 1082 let that = $(this); 1083 if(!that.hasClass('selected')){ 1084 that.addClass('selected') 1085 if($(this).find('.universalKv-toast').children().length > 0){ 1086 var controller = new ScrollMagic.Controller(); 1087 new ScrollMagic.Scene({ 1088 triggerElement: this, 1089 triggerHook: 0, 1090 offset: 0, 1091 pushFollowers: false, 1092 duration: window.innerWidth > 750 ? window.innerHeight : window.innerHeight/2, 1093 }) 1094 .setPin(this) 1095 .on("progress", function(event) { 1096 let ep = event.progress; 1097 let es = event.scrollDirection; 1098 if(ep > 0.4 && ep != 1 && es =='FORWARD' ){ 1099 that.find(".universalKv-detail").hide() 1100 that.addClass('active') 1101 that.find('.swiper-button').hide() 1102 } 1103 if( es =='REVERSE'){ 1104 that.find(".universalKv-detail").show(); 1105 that.removeClass('active') 1106 that.find('.swiper-button').show() 1107 } 1108 }) 1109 .addTo(controller); 1110 1111 1112 new ScrollMagic.Scene({ 1113 triggerElement: this, 1114 triggerHook: 'onLeave', 1115 offset: window.innerWidth > 750 ? window.innerHeight*2 : window.innerHeight, 1116 }) 1117 .on("progress", function(event) { 1118 let ep = event.progress; 1119 let es = event.scrollDirection; 1120 if(ep ==1 && es =='REVERSE'){ 1121 that.find(".universalKv-detail").show(); 1122 that.removeClass('active') 1123 } 1124 }) 1125 .addTo(controller); 1126 } 1127 if($(this).find('.config').children().length == 3){ 1128 $(this).find('.config').addClass('three') 1129 } 1130 1131 } 1132 }) 1133 }, 1134 getUrlParameter: function(name){ 1135 var url = window.location.href; 1136 var params = new URLSearchParams(new URL(url).search); 1137 return params.get(name); 1138 1139 }, 1140 universalTextSwiper: function(){ 1141 if(universalMethods.winWidth > 750){ 1142 // $('.universal-text').each(function(){ 1143 // var self = $(this); 1144 // var selfSwiper = self.find('.swiper-container')[0]; 1145 // var selfPag = self.find('.swiper-pagination')[0]; 1146 // var selfSwiperLength = $(selfSwiper).attr('swiper-length'); 1147 // if( selfSwiperLength > 3){ 1148 // new Swiper(selfSwiper , { 1149 // slidesPerView: 'auto', 1150 // initialSlide: self.hasClass('right') ? selfSwiperLength: 0, 1151 // pagination: { 1152 // el: '.swiper-pagination', 1153 // clickable: true, 1154 // }, 1155 // }); 1156 // if(self.hasClass('right')){ 1157 // $(selfSwiper).css({ 1158 // 'margin-left': 'calc(-18rem + 30px)', 1159 // }) 1160 // } 1161 // }else{ 1162 // $(selfPag).hide(); 1163 // } 1164 // }) 1165 }else{ 1166 $('.universal-text').each(function(){ 1167 var self = $(this); 1168 var selfSwiper = self.find('.swiper-container')[0]; 1169 var selfSwiperLength = $(selfSwiper).attr('swiper-length'); 1170 if(selfSwiperLength > 3){ 1171 $(self).addClass('four') 1172 } 1173 }) 1174 } 1175 }, 1176 universalDividerSMagic: function() { 1177 $('.universalDivider').each(function(index){ 1178 var $parentDetail = $(this).parents('.entranceMoreWraper'); 1179 var $this = $(this); 1180 var $child = $this.find('.swiper-container'); 1181 var $thisSwiper = $this.find('.swiper-container')[0]; 1182 var $thisLength = $this.attr('swiper-length'); 1183 var swiper = null; 1184 1185 if((!($parentDetail && $parentDetail.css('display') == 'none')) ){ 1186 if(!$(this).hasClass('scrolled')){ 1187 // console.log('universalDividerSMagicindex') 1188 // console.log(index) 1189 $(this).addClass('scrolled') 1190 if ((!$thisSwiper.swiper && $thisLength != 1)) { 1191 swiper = new Swiper($thisSwiper, { 1192 loop: true, 1193 speed:1000, 1194 autoplay: { 1195 delay: 3000 1196 }, 1197 pagination: { 1198 el: '.swiper-pagination', 1199 }, 1200 }); 1201 } 1202 1203 var observer = new MutationObserver(function(mutations) { 1204 mutations.forEach(function(mutation) { 1205 if (mutation.attributeName === 'style'&& swiper != null) {
1206 swiper.update() 1207 } 1208 }); 1209 }); 1210 observer.observe($child[0], { attributes: true }); 1211 var controller = new ScrollMagic.Controller(); 1212 var tween = gsap.to($child,1, {scale:1,marginTop: 0,marginBottom: 0,ease:Linear.easeNone}); 1213 1214 new ScrollMagic.Scene({ 1215 triggerElement: this, 1216 triggerHook: 0, 1217 duration: window.innerHeight*0.5, 1218 offset: -window.innerHeight*0.75, 1219 }) 1220 .setTween(tween) 1221 .on("progress", function(event) { 1222 let ep = event.progress; 1223 let es = event.scrollDirection; 1224 if(es === 'FORWARD' && ep>0.98 && window.innerWidth>750){ 1225 $child.css({ 1226 'transform':'scale(1)' 1227 }) 1228 } 1229 if(es === 'REVERSE' && ep>0.98 && window.innerWidth>750){ 1230 $child.css({ 1231 'transform':'scale(0.98)' 1232 }) 1233 } 1234 }) 1235 .addTo(controller); 1236 } 1237 } 1238 1239 }) 1240 1241 }, 1242 universalMediaSMagic: function() { 1243 $('.universalMedia').each(function(){ 1244 var $this = $(this); 1245 var $child = $this.find('.universalMedia-toast'); 1246 var $grandson = $this.find('.universalMedia-toast-detail'); 1247 var controller = new ScrollMagic.Controller(); 1248 // var timeline = gsap.timeline(); 1249 // timeline.to($child, {opacity:1, pause: true}) 1250 // .to($grandson, {opacity:1,bottom: universalMethods.isMobile ? "40px" : '6.4rem', pause: true}) 1251 var scene = new ScrollMagic.Scene({ 1252 triggerElement: this, 1253 triggerHook: 0, 1254 duration: universalMethods.winWidth<750 ? 100 : universalMethods.winHeight/2, 1255 }) 1256 // .setTween(timeline)
1257 .setPin(this) 1258 .on("progress", function(event) { 1259 let ep = event.progress; 1260 let es = event.scrollDirection; 1261 if((ep > 0.4 && es =='FORWARD' ) || ep == 1){ 1262 $this.addClass('active') 1263 } 1264 if(ep < 0.4 && es =='REVERSE'){ 1265 $this.removeClass('active') 1266 } 1267 }) 1268 .addTo(controller); 1269 }) 1270 }, 1271 universalToggleById(id) { 1272 if (!$(id).length) return; 1273 var $this = $(id).get(0); 1274 $($this).css('height', `${window.innerHeight}px`); 1275 var $swiper = $($this).find('.toggle-swiper').get(0); 1276 var $delay = $($swiper).attr('interval-time') ? $($swiper).attr('interval-time') : 3000; 1277 var $slides = $($swiper).find('.swiper-slide'); 1278 var $hasVideo = window.innerWidth > 750 ? $slides.find('video.pcs') : $slides.find('video.phs'); 1279 var $tabBox = $($this).find('.toggle-tab .tab-box'); 1280 var $tabSlides = $($this).find('.toggle-tab .tab-box .slide'); 1281 var $tabRemarks = $($this).find('.toggle-tab .remark'); 1282 var imageTimer = null; 1283 new Swiper($($swiper), { 1284 autoplay: ($hasVideo && $hasVideo.length) ? false : { delay: Math.floor($delay), disableOnInteraction: false }, 1285 loop: true, 1286 observer: true, 1287 observeParents: true, 1288 observeSlideChildren: true, 1289 speed: 1000, 1290 effect: 'fade', 1291 fadeEffect: { 1292 crossFade: true, 1293 }, 1294 preventClicks: true, 1295 preventClicksPropagation: true, 1296 on: { 1297 init: function() { 1298 var $swiperThis = this; 1299 $tabSlides.each(function(index, item) { 1300 var $swiperSlides = $($swiperThis.slides); 1301 $(item).on('mouseenter click', _.debounce(function() { 1302 clearTimeout(imageTimer); 1303 if (index === $swiperThis.realIndex) return false; 1304 var $swiperSlides = $($swiperThis.slides); 1305 $swiperSlides.find('video').off('loadedmetadata ended'); 1306 $swiperThis.slideToLoop(index, 1000); 1307 }, 300)); 1308 }) 1309 }, 1310 slideChange: function() { 1311 clearTimeout(imageTimer); 1312 var $swiperThis = this; 1313 var $swiperSlides = $($swiperThis.slides); 1314 $swiperSlides.find('video').off('loadedmetadata ended'); 1315 if ($swiperThis.realIndex !== $tabSlides.length - 1 && window.innerWidth <= 750) { 1316 if ($tabSlides.length === 2) { 1317 $($tabBox).css({'transform': `translateX(0px)`}); 1318 } else if ($tabSlides.length === 3) { 1319 $($tabBox).css({'transform': `translateX(${75 - $swiperThis.realIndex * 150}px)`}); 1320 } else { 1321 $($tabBox).css({'transform': `translateX(${150 - $swiperThis.realIndex * 150}px)`}); 1322 } 1323 } else if ($swiperThis.realIndex === $tabSlides.length - 1 && window.innerWidth <= 750) { 1324 if ($tabSlides.length === 3) { 1325 $($tabBox).css({'transform': `translateX(-75px)`}); 1326 } else if ($tabSlides.length === 4) { 1327 $($tabBox).css({'transform': `translateX(-150px)`}); 1328 } 1329 } 1330 $($tabSlides).removeClass('active'); 1331 $($tabSlides).eq($swiperThis.realIndex).addClass('active'); 1332 $($tabRemarks).removeClass('active'); 1333 $($tabRemarks).eq($swiperThis.realIndex).addClass('active'); 1334 var $video = window.innerWidth > 750 ? $swiperSlides.eq($swiperThis.activeIndex).find('.video-autoplay[isShow] video.pcs') : $swiperSlides.eq($swiperThis.activeIndex).find('.video-autoplay[isShow] video.phs'); 1335 if (!$($video).data('src')) { 1336 $($video).prop('src', window.innerWidth > 750 ? $swiperSlides.eq($swiperThis.activeIndex).find('.video-autoplay[isShow]').data('video-pc') : $swiperSlides.eq($swiperThis.activeIndex).find('.video-autoplay[isShow]').data('video-ph')); 1337 } 1338 if ($video && !!$video.length) { 1339 $swiperThis.autoplay && $swiperThis.autoplay.stop(); 1340 // $video.get(0).load(); 1341 $video.get(0).pause(); 1342 $video.get(0).autoplay = false; 1343 $video.get(0).loop = false; 1344 $video.on('loadedmetadata', function() { 1345 var $duration = $video.get(0).duration; 1346 if ($duration && $duration > 0) { 1347 $video.get(0).currentTime = 0;
1348 var $playPromise = $video.get(0).play(); 1349 if ($playPromise !== undefined) { 1350 $playPromise.catch(error => { 1351 console.info(error, 'video play promise error') 1352 }).then(() => { 1353 // console.info($video.get(0).currentTime, 'video play promise success') 1354 }) 1355 } else { 1356 $swiperThis.autoplay.start(); 1357 } 1358 } 1359 }).on('ended', function() { 1360 $video.get(0).autoplay = false; 1361 $video.get(0).loop = false; 1362 $video.get(0).currentTime = 0; 1363 var toIndex = $swiperThis.realIndex+1 > $swiperSlides.length ? 0 : $swiperThis.realIndex+1; 1364 $swiperThis.slideToLoop(toIndex, 1000); 1365 $swiperThis.autoplay && $swiperThis.autoplay.start(); 1366 }); 1367 if ($video.get(0).networkState === 0) { 1368 $swiperThis.autoplay && $swiperThis.autoplay.start(); 1369 } 1370 } else { 1371 $swiperThis.autoplay && $swiperThis.autoplay.start(); 1372 imageTimer = function() { 1373 var toIndex = $swiperThis.realIndex+1 > $swiperSlides.length ? 0 : $swiperThis.realIndex+1; 1374 $swiperThis.slideToLoop(toIndex, 1000); 1375 } 1376 if ($hasVideo && $hasVideo.length) { 1377 setTimeout(imageTimer, Math.floor($delay)); 1378 } else { 1379 _.debounce(imageTimer, Math.floor($delay)); 1380 } 1381 } 1382 // console.info('æ¹åäºï¼realIndex为'+$swiperThis.realIndex); 1383 }, 1384 slideChangeTransitionStart: function() {}, 1385 }, 1386 }) 1387 }, 1388 universalConfigurationById(id) { 1389 if (!$(id).length) return; 1390 var $this = $(id).get(0); 1391 $($this).css('height', `${window.innerHeight}px`); 1392 var $swiper = $($this).find('.swiper-container').get(0); 1393 var $delay = $($swiper).attr('interval-time'); 1394 var $prevEl = $($this).find('.swiper-container .swiper-button-prev').get(0); 1395 var $nextEl = $($this).find('.swiper-container .swiper-button-next').get(0); 1396 var $swiperWrapper = $($swiper).find('.swiper-wrapper'); 1397 var $slidesLength = $($swiperWrapper).find('.swiper-slide').length; 1398 var $showNum = 1; 1399 function swiperInit() { 1400 $($swiperWrapper).slick({ 1401 autoplay: $delay === 0 || $delay === '' ? false : true, 1402 autoplaySpeed: Math.floor($delay), 1403 infinite: true, 1404 slidesToShow: window.innerWidth > 750 ? $showNum : 1, 1405 slidesToScroll: 1, 1406 prevArrow: $prevEl, 1407 nextArrow: $nextEl, 1408 dots: window.innerWidth > 750 ? false : true, 1409 dotsClass: 'swiper-pagination', 1410 }).init(function() { 1411 $($swiper).find('.swiper-pagination li button').css('width', `${$('.swiper-pagination').width() / $($swiperWrapper).find('.configuration-content').length}px`); 1412 if (window.innerWidth > 750) { 1413 $($swiper).find('.swiper-pagination').css({'opacity': 0}); 1414 } 1415 }); 1416 } 1417 if (window.innerWidth > 750 && $slidesLength >= 3) { 1418 $showNum = 3; 1419 swiperInit(); 1420 } else if (window.innerWidth > 750 && $slidesLength < 3) { 1421 $showNum = $slidesLength; 1422 $($swiperWrapper).addClass(`len-${$slidesLength}`); 1423 swiperInit(); 1424 } else { 1425 swiperInit(); 1426 } 1427 }, 1428 universalExplorerById(id) { 1429 if (!$(id).length) return; 1430 var $this = $(id).get(0); 1431 $($this).css('height', `${window.innerHeight}px`); 1432 // é»è®¤æ¾ç¤ºç¬¬ä¸å¼ å¾ 1433 var explorerImageBox = $($this).find('.explorer .image-box'); 1434 explorerImageBox.eq(0).addClass('active'); 1435 // é»è®¤éä¸ç¬¬ä¸ä¸ªè²å 1436 var explorerSelectBox = $($this).find('.explorer .explorer-content .explorer-select ul'); 1437 var currentSelectLi = explorerSelectBox.find('li').eq(0); 1438 $(currentSelectLi).eq(0).addClass('active'); 1439 // 设置第ä¸ä¸ªè²åé ç½®ç360url 1440 var current360Url = $(currentSelectLi).attr('data-360url'); 1441 var explorerAnchor = $($this).find('.explorer .explorer-icon a');
1442 const urlParams = new URLSearchParams(window.location.search); 1443 const currentChannel = urlParams.get('channel'); 1444 if (current360Url) { 1445 if (currentChannel === 'QD0001') { 1446 $(explorerAnchor).off('click').on('click', function(e) { 1447 e.preventDefault(); 1448 universalMethods.handleAppRoute(current360Url); 1449 }); 1450 } else { 1451 $(explorerAnchor).attr('href', current360Url); 1452 } 1453 } else { 1454 $(explorerAnchor).css({'visibility': 'hidden'}); 1455 } 1456 explorerSelectBox.on('click', 'li', function(event) { 1457 event.stopPropagation(); 1458 event.preventDefault(); 1459 var selfEl = $(this); 1460 if ($(this).hasClass('active')) { 1461 return false; 1462 } 1463 // ç§»é¤éä¸è²å 1464 explorerSelectBox.find('li').removeClass('active'); 1465 selfEl.addClass('active'); 1466 // ç§»é¤éä¸å¾ç 1467 explorerImageBox.removeClass('active'); 1468 $(explorerImageBox).eq(selfEl.index()).addClass('active'); 1469 // 设置éä¸è²åé ç½®ç360url 1470 if (selfEl.attr('data-360url')) { 1471 $(explorerAnchor).show().css({'visibility': 'initial'}); 1472 $(explorerAnchor).attr('href', selfEl.attr('data-360url')); 1473 $(explorerAnchor).attr('target', selfEl.attr('data-target')); 1474 } else { 1475 $(explorerAnchor).css({'visibility': 'hidden'}); 1476 } 1477 }); 1478 }, 1479 universalOverlapMagicById: function(id) { 1480 // image overlap start 1481 if (!$(id).length) return; 1482 var $this = $(id).get(0); 1483 $($this).css('height', `${window.innerHeight}px`); 1484 var panel = $($this).find('section.overlap'); 1485 $(panel).find('.overlap-content .image-wrap .image-box > img, .overlap-content .image-wrap .image-box > video, .overlap-content .image-wrap .image-box .video-autoplay img.image').css('height', `${window.innerHeight}px`); 1486 var controller = new ScrollMagic.Controller(); 1487 var scene = new ScrollMagic.Scene({ 1488 triggerElement: $this, 1489 triggerHook: 0, 1490 duration: window.innerWidth > 750 ? ((window.innerHeight * 1) * $($this).find('section.overlap').length) : ((window.innerHeight / 1.5) * $($this).find('section.overlap').length), 1491 })
1492 .setPin($this) 1493 .addTo(controller); 1494 var initFlag = false; 1495 scene.on("update", function(event) { 1496 var scrollPos = event.scrollPos; 1497 var startPos = event.startPos; 1498 var difference = startPos - scrollPos; 1499 var halfHeight = window.innerHeight / 2; 1500 if (difference < halfHeight && !initFlag) { 1501 initFlag = true; 1502 $(panel).eq(0).addClass('current'); 1503 } else if ((startPos - scrollPos) > window.innerHeight) { 1504 initFlag = false; 1505 $(panel).removeClass('current reverse prev'); 1506 } 1507 }).on("progress", function(event) { 1508 let ep = event.progress; 1509 let es = event.scrollDirection; 1510 let length = panel.length; 1511 var base = 1 / length; 1512 // console.info(`overlap normal--ep: ${ep.toFixed(2)}, base: ${base}, es: ${es}`) 1513 if (es === 'PAUSED') { 1514 $(panel).eq(0).addClass('current'); 1515 } else if (es === 'FORWARD') { 1516 for( var i = 0; i < length; i++) { 1517 if (ep > (base * (i+1)) && ep < (base * (i+2))) { 1518 // console.info(i+1, i,'FORWARD') 1519 $(panel).removeClass('current reverse prev'); 1520 $(panel[i]).addClass('prev'); 1521 $(panel[i+1]).addClass('current'); 1522 } else if (ep >= (base * i)) { 1523 $(panel).removeClass('current reverse prev'); 1524 $(panel[i-1]).addClass('prev'); 1525 $(panel[i]).addClass('current'); 1526 } else { 1527 // console.info(`overlap FORWARD--ep: ${ep.toFixed(2)}, base: ${base}, es: ${es}`) 1528 } 1529 } 1530 } else if (es === 'REVERSE') { 1531 for(var i = 0; i < length; i++) { 1532 if (ep > (base * i) && ep < (base * (i+1))) { 1533 // console.info(i, i+1,'REVERSE') 1534 $(panel).removeClass('current reverse prev'); 1535 $(panel[i]).addClass('reverse'); 1536 $(panel[i+1]).addClass('prev'); 1537 } else { 1538 // console.info(`overlap REVERSE--ep: ${ep.toFixed(2)}, base: ${base}, es: ${es}`) 1539 } 1540 } 1541 } 1542 }); 1543 // image overlap end 1544 }, 1545 universalOverlayMagicById: function(id) { 1546 // overlay image start 1547 if (!$(id).length) return; 1548 var $this = $(id).get(0); 1549 $($this).css('height', `${window.innerHeight}px`); 1550 var controller = new ScrollMagic.Controller(); 1551 var scene = new ScrollMagic.Scene({ 1552 triggerElement: $this, 1553 triggerHook: 0, 1554 duration: window.innerWidth > 750 ? ((window.innerHeight * 1) * $($this).find('section.overlay').length) : ((window.innerHeight / 1.5) * $($this).find('section.overlay').length), 1555 })
1556 .setPin($this) 1557 .addTo(controller); 1558 var initFlag = false; 1559 var panel = $($this).find('section.overlay'); 1560 scene.on("update", function(event) { 1561 var scrollPos = event.scrollPos; 1562 var startPos = event.startPos; 1563 var difference = startPos - scrollPos; 1564 var halfHeight = window.innerHeight / 2; 1565 if (difference < halfHeight && !initFlag) { 1566 initFlag = true; 1567 $(panel).eq(0).addClass('current'); 1568 } else if ((startPos - scrollPos) > window.innerHeight) { 1569 initFlag = false; 1570 $(panel).removeClass('current reverse prev'); 1571 } 1572 }).on("progress", function(event) { 1573 let ep = event.progress; 1574 let es = event.scrollDirection; 1575 let length = panel.length; 1576 var base = 1 / length; 1577 // console.info(`overlay normal--ep: ${ep.toFixed(2)}, base: ${base}, es: ${es}`) 1578 if (es === 'PAUSED') { 1579 $(panel).eq(0).addClass('current'); 1580 } else if (es === 'FORWARD') { 1581 for( var i = 0; i < length; i++) { 1582 if (ep > (base * (i+1)) && ep < (base * (i+2))) { 1583 // console.info(i+1, i,'FORWARD') 1584 $(panel).removeClass('current reverse prev'); 1585 $(panel[i]).addClass('prev'); 1586 $(panel[i+1]).addClass('current'); 1587 } else if (ep >= (base * i)) { 1588 $(panel).removeClass('current reverse prev'); 1589 $(panel[i-1]).addClass('prev'); 1590 $(panel[i]).addClass('current'); 1591 } else { 1592 // console.info(`overlay FORWARD--ep: ${ep.toFixed(2)}, base: ${base}, es: ${es}`) 1593 } 1594 } 1595 } else if (es === 'REVERSE') { 1596 for(var i = 0; i < length; i++) { 1597 if (ep > (base * i) && ep < (base * (i+1))) { 1598 // console.info(i, i+1,'REVERSE') 1599 $(panel).removeClass('current reverse prev'); 1600 $(panel[i]).addClass('reverse'); 1601 $(panel[i+1]).addClass('prev'); 1602 } else { 1603 // console.info(`overlay REVERSE--ep: ${ep.toFixed(2)}, base: ${base}, es: ${es}`) 1604 } 1605 } 1606 } 1607 }); 1608 // overlay image end 1609 }, 1610 hideMenu: function(e) { 1611 if($('.universalSubHeader').length==0 || $('.phone-nav').hasClass('active')){return false} 1612 if(universalMethods.swiperData){ 1613 universalMethods.swiperData.autoplay.stop(); 1614 if($('.universalKv .swiper-slide-active .universalKv-video')[0]){ 1615 $('.universalKv .swiper-slide-active .universalKv-video')[0].pause(); 1616 } 1617 if($('.universalKv .swiper-slide-active .universalKv-video')[1]){ 1618 $('.universalKv .swiper-slide-active .universalKv-video')[1].pause(); 1619 } 1620 }else{ 1621 if($('.universalKv .swiper-slide .universalKv-video')[0]){ 1622 $('.universalKv .swiper-slide .universalKv-video')[0].pause(); 1623 } 1624 if($('.universalKv .swiper-slide .universalKv-video')[1]){ 1625 $('.universalKv .swiper-slide .universalKv-video')[1].pause(); 1626 } 1627 } 1628 if(!$('.LKheader').hasClass('down') && !$('.LKheader').hasClass("menu-expand")){ 1629 if(universalMethods.winWidth < 750){ 1630 $('.LKheader').addClass('down').removeClass('up').stop().animate({top: '-50px'},500); 1631 }else{ 1632 $('.LKheader').addClass('down').removeClass('up').stop().animate({top: '-70px'},500); 1633 $('.TopMenuDropdown.pcshow').hide() 1634 } 1635 $('.universalSubHeader').css('display','flex').stop().animate({top:0},500); 1636 if($('.carConfigPage').length>0){ 1637 $('.carConfigPage').stop().animate({paddingTop: '0'},500); 1638 } 1639 } 1640 }, 1641 showMenu: function(e) { 1642 if(universalMethods.swiperData){ 1643 universalMethods.swiperData.autoplay.start(); 1644 if($('.universalKv .swiper-slide-active .universalKv-video')[0]){ 1645 $('.universalKv .swiper-slide-active .universalKv-video')[0].play(); 1646 } 1647 if($('.universalKv .swiper-slide-active .universalKv-video')[1]){ 1648 $('.universalKv .swiper-slide-active .universalKv-video')[1].play(); 1649 } 1650 }else{ 1651 if($('.universalKv .swiper-slide .universalKv-video')[0]){ 1652 $('.universalKv .swiper-slide .universalKv-video')[0].play(); 1653 } 1654 if($('.universalKv .swiper-slide .universalKv-video')[1]){ 1655 $('.universalKv .swiper-slide .universalKv-video')[1].play(); 1656 } 1657 } 1658 if(!$('.LKheader').hasClass('up')){ 1659 var top = universalMethods.winWidth > 750 ? 150 : 100 1660 if($(window).scrollTop() <=150){ 1661 $('.LKheader').addClass('up').removeClass('down').stop().animate({top:0},500); 1662 if(universalMethods.winWidth < 750){ 1663 $('.universalSubHeader').css('display','none').stop().animate({top:'50px'},500); 1664 $('.carConfigPage').stop().animate({paddingTop: $('.LKheader').length ? '49px' : '0px'},500); 1665 }else{ 1666 $('.universalSubHeader').css('display','none').stop().animate({top:'70px'},500); 1667 $('.carConfigPage').stop().animate({paddingTop: '70px'},500); 1668 } 1669 }else{ 1670 $('.universalSubHeader').stop().animate({top:'0px'},500); 1671 } 1672 } 1673 }, 1674 scrollFunc: function(e) { 1675 var e = e || window.event; 1676 if(e.wheelDelta) { 1677 if(e.wheelDelta > 0) { 1678 universalMethods.showMenu() 1679 } 1680 if(e.wheelDelta < 0) { 1681 universalMethods.hideMenu() 1682 } 1683 } else if(e.detail) { 1684 if(e.detail < 0) { 1685 universalMethods.showMenu() 1686 } 1687 if(e.detail > 0) { 1688 universalMethods.hideMenu() 1689 } 1690 } 1691 }, 1692 touchStartFun: function(event){ 1693 universalMethods.startY = event.touches[0].clientY; 1694 }, 1695 touchMoveFunc: function(event){ 1696 var currentY = event.touches[0].clientY; 1697 if (currentY < universalMethods.startY) {// å䏿»å¨ 1698 $('.universalSubHeader').removeClass('active') 1699 universalMethods.hideMenu() 1700 } else if (currentY > universalMethods.startY) { 1701 $('.universalSubHeader').removeClass('active') 1702 universalMethods.showMenu() 1703 } 1704 }, 1705 titleAnimation: function(e){
1706 $('.universal-text').each(function() { 1707 var node = $(this); 1708 var nodeTop = node.offset().top; 1709 var nodeHeight = node.outerHeight(); 1710 1711 var scrollTop = $(window).scrollTop(); 1712 var windowHeight = $(window).height(); 1713 var nodeInViewTop = nodeTop - windowHeight; 1714 // if (scrollTop > nodeInViewTop + nodeHeight/2 ) { 1715 // node.addClass('active'); 1716 // } 1717 // if (scrollTop < nodeInViewTop ) { 1718 // node.removeClass('active'); 1719 // } 1720 if(node.find('.title').length == 0){ 1721 node.find('.subTitle').css('marginTop',0) 1722 } 1723 if(node.parents('.universalDivider').length>0){ 1724 var nodeParents = $(node.parents('.universalDivider')); 1725 var nodeParentsInViewTop = nodeParents.offset().top - windowHeight; 1726 if (scrollTop > nodeParentsInViewTop + document.documentElement.clientHeight*0.75 + 60 ) { 1727 node.addClass('active'); 1728 } 1729 if (scrollTop < nodeParentsInViewTop + document.documentElement.clientHeight*0.75 + 60 ) { 1730 node.removeClass('active'); 1731 } 1732 }else{ 1733 if (scrollTop > nodeInViewTop + nodeHeight/2 ) { 1734 node.addClass('active'); 1735 } 1736 if (scrollTop < nodeInViewTop ) { 1737 node.removeClass('active'); 1738 } 1739 } 1740 }); 1741 }, 1742 kvDetailAnimation: function(e){ 1743 $('.universalKv-detail, .universal-toggle .toggle-tab').each(function() { 1744 var node = $(this); 1745 var nodeTop = node.offset().top; 1746 var nodeHeight = node.outerHeight(); 1747 1748 var scrollTop = $(window).scrollTop(); 1749 var windowHeight = $(window).height(); 1750 var nodeInViewTop = nodeTop - windowHeight; 1751 if (scrollTop > nodeInViewTop + nodeHeight/2 ) { 1752 node.addClass('active'); 1753 } 1754 if (scrollTop < nodeInViewTop ) { 1755 node.removeClass('active'); 1756 } 1757 }); 1758 }, 1759 headerMobileMenuShow: function(){ 1760 if(window.innerWidth < 768){ 1761 $('body').on('click','.logo',function(event){ 1762 event.stopPropagation() 1763 $('.universalSubHeader').addClass('active') 1764 }); 1765 } 1766 }, 1767 scrollImage: function(){ 1768 $('.ScrollingImage').each(function(ScrollingImageIndex,item){ 1769 var $parentDetail = $(this).parents('.entranceMoreWraper'); 1770 if((!($parentDetail && $parentDetail.css('display') == 'none')) ){ 1771 if(!$(this).hasClass('scrolled')){ 1772 $(this).addClass('scrolled ScrollingImage'+ScrollingImageIndex) 1773 let positionData = [] 1774 let controller = new ScrollMagic.Controller(); 1775 let tween = gsap.timeline(); 1776 let that = $(this); 1777 if(window.innerWidth>750){ 1778 that.find('.detail.pcs').each(function(){ 1779 let node = $(this); 1780 positionData.push({ 1781 positionX: node.attr('positionX'), 1782 positionY: node.attr('positionY'), 1783 }) 1784 }) 1785 }else{ 1786 that.find('.detail.phs').each(function(){ 1787 let node = $(this); 1788 positionData.push({ 1789 positionX: node.attr('positionX'), 1790 positionY: node.attr('positionY'), 1791 }) 1792 }) 1793 } 1794 1795 let winHeight = window.innerHeight; 1796 let winWidth = window.innerWidth; 1797 // è·åå¾åçå®é 尺寸 1798 var imageWidth; 1799 var imageHeight; 1800 var scale ; 1801 if(window.innerWidth>750){ 1802 imageWidth = that.find('.ScrollingImage-main img').attr('data-width'); 1803 imageHeight = that.find('.ScrollingImage-main img').attr('data-height'); 1804 scale = that.find('.ScrollingImage-main img').attr('data-scale'); 1805 }else{ 1806 imageWidth = that.find('.ScrollingImage-main img').attr('data-width-mobile'); 1807 imageHeight = that.find('.ScrollingImage-main img').attr('data-height-mobile'); 1808 scale = that.find('.ScrollingImage-main img').attr('data-scale-mobile'); 1809 } 1810 // 计ç®å¾ç宽髿¯ 1811 var imageRatio = imageWidth / imageHeight; 1812 // è®¡ç®æµè§å¨å®½é«æ¯æ¯ä¾ 1813 var windowRatio = winWidth / winHeight; 1814 1815 //计ç®å¾çåæµè§å¨æ¯ä¾ 1816 let widthRatio = winWidth / imageWidth; 1817 let heightRatio = winHeight / imageHeight; 1818 1819 let domWidth = winHeight * imageRatio; 1820 if(window.innerWidth < 750){ 1821 let widthRatio = domWidth / imageWidth; 1822
1823 that.find('.ScrollingImage-main').width(domWidth) 1824 positionData.map( (item, index)=>{ 1825 let initDetailX = item.positionX; 1826 let initDetailY = item.positionY; 1827 let className = '.detailIndex' + index 1828 that.find(className).addClass(item.position); 1829 item.positionX = widthRatio * item.positionX; 1830 let initPositionX = item.positionX; 1831 item.positionY = 0; 1832 item.detailX = widthRatio * initDetailX; 1833 item.detailY = initDetailY / imageHeight * winHeight 1834 if(item.positionX > winWidth){ // è¶ åºæ¾å¤§åå第ä¸åºé´ï¼éè¦æ·»å ä½ç§» 1835 item.positionX = winWidth/2 - item.positionX; 1836 item.detailX = '50%' 1837 if(item.positionX < -domWidth + winWidth){ // è¶ åºå¾çèå´ 1838 item.detailX = winWidth - (domWidth - initPositionX); 1839 item.positionX = -domWidth + winWidth ; 1840 console.log(index) 1841 console.log(winWidth - (domWidth - initPositionX)) 1842 //鲿¢æç¤ºæ¡è¢«é®ç 1843 // var lettGap = 67 - Number(winWidth - item.detailX) + 10; 1844 // var mainLeft; 1845 // if(window.innerWidth>750){ 1846 // mainLeft = that.find('.detail.pcs').eq(index).find('.detail-main').css('left').replace('px',''); 1847 // }else{ 1848 // mainLeft = that.find('.detail.phs').eq(index).find('.detail-main').css('left').replace('px',''); 1849 // } 1850 // let number = mainLeft - lettGap + 'px' 1851 // if(window.innerWidth>750){ 1852 // that.find('.detail.pcs').eq(index).find('.detail-main').css('left',number) 1853 // }else{ 1854 // that.find('.detail.phs').eq(index).find('.detail-main').css('left',number) 1855 // } 1856 } 1857 }else { // ä¸éè¦æ·»å ä½ç§» 1858 item.positionX = 0 1859 } 1860 1861 //鲿¢æç¤ºæ¡è¢«é®ç 1862 var element; 1863 if(window.innerWidth>750){ 1864 element = that.find('.detail.pcs').eq(index).find('.detail-main'); 1865 }else{ 1866 element = that.find('.detail.phs').eq(index).find('.detail-main'); 1867 } 1868 if(item.detailX != '50%' & item.detailX < 67){ 1869 element.css('left', - item.detailX + 10) 1870 } 1871 addTween(item,index); 1872 return item 1873 }) 1874 } else { 1875 var croppedWidth = 0; 1876 var croppedHeight = 0; 1877 var croDirection = null; 1878 1879 if(imageRatio>windowRatio){ 1880 //宽度è£åª 1881 croDirection = 'width' 1882 croppedWidth = Math.abs(winWidth - winHeight * imageRatio); 1883 } 1884 if(imageRatio<windowRatio){ 1885 //é«åº¦è£åª 1886 croDirection = 'height' 1887 croppedHeight = Math.abs(winHeight - winWidth / imageRatio); 1888 } 1889 1890 positionData.map( (item, index)=>{ 1891 let initDetailX = item.positionX; 1892 let initDetailY = item.positionY; 1893 let className = '.detailIndex' + index 1894 1895 if(index ==0 ){ 1896 item.scale = scale 1897 } 1898 // 计ç®åº ï¼ åå§ä½ç§»æ ¹æ®æµè§å¨çæ¯ä¾ç¼©æ¾åï¼åå»è£åªé¨åï¼åä¹ä»¥æ¾å¤§åæ°åçæ ååæ 1899 if(croDirection == 'height'){ 1900 item.detailX = (widthRatio * initDetailX - croppedWidth/2) * scale; 1901 item.positionX = (widthRatio * initDetailX - croppedWidth/2) * scale; 1902 item.positionY = (widthRatio * initDetailY - croppedHeight/2) * scale; 1903 item.detailY = (widthRatio * initDetailY - croppedHeight/2) * scale; 1904 }else{ 1905 item.detailX = (heightRatio * initDetailX - croppedWidth/2) * scale; 1906 item.positionX = (heightRatio * initDetailX - croppedWidth/2) * scale; 1907 item.positionY = (heightRatio * initDetailY - croppedHeight/2) * scale; 1908 item.detailY = (heightRatio * initDetailY - croppedHeight/2) * scale; 1909 } 1910 //ä¿çåå§å¼ 1911 var detailX = item.detailX; 1912 var detailY = item.detailY; 1913 //Xè½´ 1914 if(item.positionX >
1914 winWidth/2){ //è¶ åºæ¾å¤§åå第ä¸åºé´ï¼éè¦æ·»å ä½ç§» 1915 item.positionX = winWidth/2 - item.positionX; 1916 item.detailX = '50%' 1917 if(item.positionX < -winWidth * (scale - 1)){ // è¶ åºå¾çèå´ 1918 item.positionX = - winWidth * (scale - 1); 1919 item.detailX = detailX -winWidth * (scale - 1) ; 1920 } 1921 }else { // ä¸éè¦æ·»å ä½ç§» 1922 item.positionX = 0 1923 } 1924 1925 // yè½´ 1926 if(item.positionY > winHeight/2 ){ 1927 item.positionY = winHeight/2 - item.positionY 1928 item.detailY = '50%' 1929 if(item.positionY < -winHeight * (scale - 1)){ // è¶ åºå¾çèå´ 1930 item.positionY = - winHeight * (scale - 1); 1931 item.detailY = detailY -winHeight * (scale - 1) ; 1932 } 1933 }else { 1934 item.positionY = 0 1935 } 1936 addTween(item,index); 1937 return item 1938 }) 1939 } 1940 1941 new ScrollMagic.Scene({ 1942 triggerElement: this, 1943 triggerHook: 0, 1944 offset: 0, 1945 pushFollowers: false, 1946 duration: window.innerWidth > 750 ? positionData.length*winHeight*(universalMethods.getUrlParameter('speed')||0.6) :positionData.length*(winHeight*(universalMethods.getUrlParameter('mobileSpeed')||1.2)) // æç»æ¶é´ï¼æ ¹æ®å®é æ åµè¿è¡è°æ´ 1947 }) 1948 .setPin(this) 1949 .setTween(tween) 1950 .addTo(controller); 1951 1952 function addTween(target, index,title) { 1953 var { scale, positionX, positionY, detailX, detailY, title, content} = target; 1954 if(window.innerWidth>750){ 1955 tween.to('.detail.pcs', 0, {opacity:0}) 1956 }else{ 1957 tween.to('.detail.phs', 0, {opacity:0}) 1958 } 1959 if(item.detailX != '50%' & item.detailX < 67){ 1960 element.css('left', - item.detailX + 10) 1961 } 1962 if(index==0){ 1963 if(window.innerWidth < 750){ 1964 tween.to('.ScrollingImage'+ScrollingImageIndex+' .ScrollingImage-main', 0.05,{x:positionX,y:positionY}) 1965 }else{ 1966 tween.to('.ScrollingImage'+ScrollingImageIndex+' .ScrollingImage-main',0.01, {scale: scale,x:positionX,y:positionY}) 1967 } 1968 }else{ 1969 tween.to('.ScrollingImage'+ScrollingImageIndex+' .ScrollingImage-main', 0.05, {x:positionX,y:positionY}) 1970 } 1971 tween.to('.ScrollingImage'+ScrollingImageIndex+' .lineImg', 0,{ 1972 transitionDuration: '0.5s', 1973 }) 1974 tween.to('.ScrollingImage'+ScrollingImageIndex+' .detailIndex'+index, 0, { 1975 top: detailY, 1976 left: detailX 1977 }) 1978 tween.to('.ScrollingImage'+ScrollingImageIndex+' .detailIndex'+index, 0,{ 1979 opacity: 1, 1980 }) 1981 tween.to('.ScrollingImage'+ScrollingImageIndex+' .lineImg', 0, { 1982 opacity: 1, 1983 height: window.innerWidth < 750 ? '147px' : '18rem', 1984 ease: Power0, 1985 }) 1986 tween.to('.ScrollingImage'+ScrollingImageIndex+' .lineImg',0, { 1987 opacity: 1, 1988 height: window.innerWidth < 750 ? '147px' : '18rem', 1989 ease: Power0 1990 }) 1991 tween.to('.ScrollingImage'+ScrollingImageIndex+' .detail-main',0,{ 1992 opacity: 1, 1993 ease: Power0, 1994 transitionDuration: '0.3s', 1995 transitionDelay: '0.3s' 1996 }) 1997 tween.to('.ScrollingImage'+ScrollingImageIndex+' .detail-main',{ 1998 opacity: 1, 1999 ease: Power0 2000 }) 2001 tween.to('.ScrollingImage'+ScrollingImageIndex+' .detailIndex'+index,0, { 2002 opacity: 0, 2003 }) 2004 tween.to('.ScrollingImage'+ScrollingImageIndex+' .lineImg',0, { 2005 height: '0', 2006 transitionDuration: '0s', 2007 ease: Power0 2008 }) 2009 tween.to('.ScrollingImage'+ScrollingImageIndex+' .detail-main',0, { 2010 opacity: 0, 2011 transitionDuration: '0s', 2012 transitionDelay: 0, 2013 }) 2014 } 2015 } 2016 } 2017 2018 }) 2019 }, 2020 initVideoToImage: function(){ 2021 $('.videoToImage').each(function(){ 2022 var that = $(this); 2023 if(universalMethods.isMobile){ 2024 var paddingTop = (window.innerHeight - $(this).find('.videoToImage-main').height() - 100) / 2 - 60; 2025 that.find('.videoToImage-main').css({ 2026 paddingTop: paddingTop + 'px' 2027 }) 2028 if(paddingTop<0){ 2029 that.find('.videoToImage-main .universal-text').css({ 2030 paddingTop: 60 + paddingTop/2 + 'px' 2031 }) 2032 } 2033 } 2034 var imgLength = that.find('.videoToImage-list').data('length'); 2035 var position = 0; 2036 var showDetailListStart = [];//åªåstartæ°å¼ç 2037 var showDetailListEnd = [];//åªåendæ°å¼ç 2038 var timeline = gsap.timeline();//å¾çå¨ç» 2039 var textTimeline = gsap.timeline();//æåå¨ç» 2040 that.find('.videoToImage-detail-item').each(function(){ 2041 showDetailListStart.push($(this).data('start')) 2042 showDetailListEnd.push($(this).data('end')) 2043 }) 2044 for(var index=1; index<= imgLength; index++){//夿å¾çæ¯å¦æå¯¹åºçææ¡ 2045 if(index!=0){ 2046 //å¾çå¨ç» 2047 var targetElement = that.find('.videoToImage-image').eq(index); 2048 var targetElementOld = that.find('.videoToImage-image').eq(index-3); 2049 timeline.to( targetElementOld ,0,{ 2050 opacity:0, 2051 },position++) 2052 timeline.to( targetElement ,0,{ 2053 opacity:1, 2054 },position++) 2055 //æåå¨ç» 2056 var hasTwelveStart = $.inArray(index, showDetailListStart); 2057 var hasTwelveEnd= $.inArray(index, showDetailListEnd); 2058 if (hasTwelveStart !== -1) { 2059 var targetElementOther = that.find('.videoToImage-detail-item[data-start="'+ index +'"]'); 2060 textTimeline.to(targetElementOther,{ 2061 translateY: 0, 2062 opacity:1, 2063 duration:0, 2064 ease: Power0, 2065 // duration: 10 2066 // },position-10) 2067 },position-3) 2068 } 2069 if (hasTwelveEnd !== -1) { 2070 var targetElementOther = that.find('.videoToImage-detail-item[data-end="'+ index +'"]'); 2071 textTimeline.to(targetElementOther,{ 2072 translateY: "20px", 2073 opacity:0, 2074 duration:0, 2075 ease: Power0, 2076 // duration: 10 2077 },position-1) 2078 // },position-1) 2079 } 2080 } 2081 } 2082 var controller = new ScrollMagic.Controller(); 2083 new ScrollMagic.Scene({ 2084 triggerElement: this, 2085 triggerHook: 0, 2086 duration: imgLength * 100, 2087 })
2088 .setPin(this) 2089 .setTween([timeline,textTimeline]) 2090 .addTo(controller); 2091 }) 2092 }, 2093 toTestDriver: function(){ 2094 var id = '#' + universalMethods.getUrlParameter('testdriver') 2095 if(universalMethods.getUrlParameter('testdriver')){ 2096 window.scrollTo(0, $(id).offset().top); 2097 if(universalMethods.winWidth < 750){ 2098 $('.LKheader').addClass('down').removeClass('up').stop().animate({top: '-50px'},500); 2099 }else{ 2100 $('.LKheader').addClass('down').removeClass('up').stop().animate({top: '-70px'},500); 2101 } 2102 $('.universalSubHeader').css('display','flex').stop().animate({top:0},500); 2103 } 2104 }, 2105 initCartSet: function(){ 2106 $('.cartSet-list').each(function(){ 2107 var $this = $(this); 2108 var timeline = gsap.timeline(); 2109 var timeline2 = gsap.timeline(); 2110 var timeline3 = gsap.timeline(); 2111 var $itemFirst = $this.find('img:eq(0)'); 2112 var $itemSecond = $this.find('img:eq(1)'); 2113 var $itemThree = $this.find('img:eq(2)'); 2114 var $itemFour = $this.find('img:eq(3)'); 2115 let mobileListLengt = $this.data('length'); 2116 if(window.innerWidth<750){ 2117 timeline.to([$itemFirst], { 2118 transform: 'none', 2119 }) 2120 2121 timeline3.to([$itemFour], { 2122 translateY: 0, 2123 }) 2124 2125 var controller = new ScrollMagic.Controller(); 2126 new ScrollMagic.Scene({ 2127 triggerElement: this, 2128 triggerHook: 'onEnter', 2129 offset: window.innerHeight * 0.3 + 74 , 2130 duration: window.innerHeight * 0.5, 2131 ease:Power0 2132 }) 2133 .setTween(timeline) 2134 .addTo(controller); 2135 2136 if(mobileListLengt>2){ 2137 timeline2.to([$itemSecond], { 2138 translateY: '20px' 2139 },'first') 2140 timeline2.to([$itemThree], { 2141 translateX: '-30px' 2142 },'first') 2143 timeline2.to([$itemSecond,$itemThree], { 2144 translateY: 0, 2145 translateX: 0, 2146 },'second') 2147 2148 new ScrollMagic.Scene({ 2149 triggerElement: this, 2150 triggerHook: 'onEnter', 2151 offset: window.innerHeight * 0.3 + 74, 2152 duration: window.innerHeight * 0.5, 2153 }) 2154 .setTween(timeline2) 2155 .addTo(controller); 2156 2157 2158 new ScrollMagic.Scene({ 2159 triggerElement: this, 2160 triggerHook: 'onEnter', 2161 offset: window.innerHeight * 0.6 + 74, 2162 duration: window.innerHeight * 0.5, 2163 }) 2164 .setTween(timeline3) 2165 .addTo(controller); 2166 2167 }else{ 2168 timeline2.to([$itemSecond], { 2169 transform: 'none', 2170 }) 2171 new ScrollMagic.Scene({ 2172 triggerElement: this, 2173 triggerHook: 'onEnter', 2174 offset: window.innerHeight * 0.5 + 74, 2175 duration: window.innerHeight * 0.5, 2176 }) 2177 .setTween(timeline2) 2178 .addTo(controller); 2179 } 2180 2181 2182 }else{ 2183 timeline.to([$itemFirst,$itemSecond], { 2184 transform: 'none' 2185 }) 2186 timeline2.to([$itemThree,$itemFour], { 2187 transform: 'none', 2188 ease:Linear.easeNone 2189 }) 2190 2191 var controller = new ScrollMagic.Controller(); 2192 new ScrollMagic.Scene({ 2193 triggerElement: this, 2194 triggerHook: 'onEnter', 2195 offset: 300, 2196 duration: window.innerHeight * 0.3, 2197 }) 2198 .setTween(timeline) 2199 .addTo(controller); 2200 2201 2202 new ScrollMagic.Scene({ 2203 triggerElement: this, 2204 triggerHook: 'onEnter', 2205 offset: window.innerHeight * 0.6 + 100, 2206 duration: window.innerHeight * 0.6, 2207 }) 2208 .setTween(timeline2) 2209 .addTo(controller); 2210 } 2211 }) 2212 $('.cartSet-menu li').click(function(){ 2213 var index = $(this).index(); 2214 var $parent = $(this).parents('.cartSet'); 2215 $(this).addClass('active').siblings().removeClass('active'); 2216 if(window.innerWidth>750){ 2217 $parent.find('.pcs .cartSet-list').eq(index).show().css({'position':'relative','opacity':1}).addClass('active').siblings().removeClass('active').css({'position':'absolute','opacity':0}); 2218 }else{ 2219 $parent.find('.phs .cartSet-list').eq(index).show().css({'position':'relative','opacity':1}).addClass('active').siblings().removeClass('active').css({'position':'absolute','opacity':0}); 2220 } 2221 }) 2222 }, 2223 menuScrollTo: function(){ 2224 // 导èªèå项ç¹å»äºä»¶ 2225 if(window.innerWidth>750){ 2226 $('body').on('click','.universalSubHeader .menu a',function(event){ 2227 event.preventDefault(); 2228 universalMethods.winScrolling = true; 2229 var targetId = $(this).attr('href'); 2230 var targetSection = $(targetId); 2231 2232 $(this).addClass('active').siblings().removeClass('active') 2233 $('.universalSubHeader').removeClass('active') 2234
2235 if (targetSection.length>0) { 2236 window.scrollTo(0, targetSection.offset().top); 2237 } 2238 setTimeout(function(){ 2239 universalMethods.winScrolling = false; 2240 },100) 2241 universalMethods.beforeActive = false 2242 universalMethods.beforeActiveIndex = null 2243 }); 2244 }else{ 2245 $('body').on('touchend', '.universalSubHeader .menu a', function(event) { 2246 event.preventDefault(); 2247 universalMethods.winScrolling = true; 2248 var targetId = $(this).attr('href'); 2249 var targetSection = $(targetId); 2250 $('.menu a').removeClass('active'); 2251 $(this).addClass('active') 2252 $('.universalSubHeader').removeClass('active'); 2253 if (targetSection.length>0) { 2254 $('html, body').animate({ 2255 scrollTop: targetSection.offset().top 2256 }, 0); // 设置æ»å¨æ¶é´ï¼å¯æ ¹æ®éè¦è°æ´ 2257 setTimeout(function(){ 2258 universalMethods.winScrolling = false; 2259 },100) 2260 } 2261 }); 2262 } 2263 2264 }, 2265 videoPlayFun: function(){ 2266 $('.android-box video.phs').on('playing', function() { 2267 $(this).parents('.android-box').find('.video-autoplay-icon').hide() 2268 }) 2269 $('body').on('click', '.mz-box .icon', function() { 2270 let that = $(this).parents('.video-autoplay'); 2271 2272 universalMethods.winScrollTop = $(window).scrollTop(); 2273 $('html,body').css({ 2274 'overflow':'hidden', 2275 'position':'fixed', 2276 }) 2277 var videoSrc = ''; 2278 if(universalMethods.isMobile){ 2279 videoSrc = that.data('video-ph')||that.parents('.video-autoplay-other').data('video-ph') 2280 } else { 2281 videoSrc = that.data('video-pc')||that.parents('.video-autoplay-other').data('video-pc') 2282 } 2283 var videoClose = that.data('close')||that.parents('.video-autoplay-other').data('close'); 2284 var mask = $('<div>').addClass('maskvideo'); 2285 var video = $('<video>') 2286 .attr('src', videoSrc) 2287 .attr('muted', true) 2288 .attr('autoplay', true) 2289 mask.append(video); 2290 if($(this).hasClass('long')){ 2291 video.css({ 2292 'width':'100vw !important','object-fit':'contain','display': 'flex','align-items':'center' 2293 }) 2294 } 2295 var $video = video 2296 $video.get(0).load(); 2297 $video.get(0).pause(); 2298 $video.on('loadedmetadata', function() { 2299 var $duration = $video.get(0).duration; 2300 $video.get(0).currentTime = 0; 2301 var $playPromise = $video.get(0).play(); 2302 if ($playPromise !== undefined) { 2303 $playPromise.catch(error => { 2304 console.info(error, 'video play promise error') 2305 }).then(() => { 2306 console.info($video.get(0).currentTime, 'video play promise success') 2307 }) 2308 } 2309 }).on('ended', function() { 2310 $('.maskvideo .close').click() 2311 }); 2312 var closeButton = $('<img>').addClass('close').attr('src',videoClose ); 2313 mask.append(closeButton); 2314 $('body').append(mask); 2315 2316 2317 }); 2318 $('body').on('click', '.maskvideo .close', function() { 2319 var that = this 2320 $('html,body').css({ 2321 'overflow-y':'auto', 2322 'position':'static', 2323 }) 2324 $(window).scrollTop(universalMethods.winScrollTop) 2325 $(this).closest('.maskvideo').fadeOut().remove(); 2326 }); 2327 $('body').on('click', '.video-autoplay-icon', function() { 2328 $(this).parent().find('.phs')[0].play(); 2329 $(this).hide() 2330 }); 2331 2332 }, 2333 isAndroid: function(){ 2334 return /android/i.test(navigator.userAgent); 2335 }, 2336 isiOS: function(){ 2337 return /iphone|ipad|ipod/i.test(navigator.userAgent); 2338 }, 2339 isWechat: function(){ 2340 var ua = navigator.userAgent.toLowerCase(); 2341 return ua.indexOf('micromessenger') !== -1; 2342 }, 2343 inputFocusFun: function(){ 2344 if(universalMethods.isMobile){ 2345 var inputElements = document.querySelectorAll('input:not([type="checkbox"])');
2346 inputElements.forEach(function(inputElement) { 2347 inputElement.addEventListener('focus', function() { 2348 if (!inputElement.closest('.dealer-agreement') || !inputElement.closest('.dealer-sex')) { 2349 setTimeout(function() { 2350 // 计ç®ç®æ æ»å¨ä½ç½® 2351 var targetScrollPosition = inputElement.getBoundingClientRect().top + window.scrollY - 100; 2352 window.scroll(0, targetScrollPosition); 2353 }, 100); // å»¶è¿ 100 æ¯«ç§æ»å¨ 2354 } 2355 }); 2356 }); 2357 } 2358 }, 2359 lazyLoadFun: function(lazyArray){ 2360 if(universalMethods.isMobile){ 2361 $('.lazyDomMobile').Lazy({ 2362 bind: 'event', 2363 threshold: 500, 2364 exclude: function(element) {//å¦æè¯¦æ 弹屿²¡å±å¼è¯¦æ å çç»ä»¶ä¸è¿è¡æå è½½ 2365 if($(element).closest('.entranceWraper').css('display') != 'none'){ 2366 return $(element).closest('.entranceWraper').length > 0; 2367 }else{ 2368 return false; 2369 } 2370 }, 2371 customLoaderName: function(element) { 2372 $(element).find('.lazyDomMobile[data-src]').each((v,i)=>{ 2373 var newsrc = $(i).attr('data-src'); 2374 $(i).attr('src',newsrc) 2375 }) 2376 $(element).find('data-src').each((v,i)=>{ 2377 if($(i).parent().hasClass('lazyDomMobile')){ 2378 var dataSrc = $(i).attr('src'); 2379 var sourceElement = $('<source>'); 2380 sourceElement.attr('src', dataSrc); 2381 2382 $(i).before(sourceElement); 2383 $(i).remove(); 2384 } 2385 }) 2386 var v = element.is('video') ? element[0] : element.find('video')[0]; 2387 if (v && v.load) v.load(); 2388 element.load(); 2389 }, 2390 beforeLoad: function(element) { 2391 var posterUrl = $(element).data('poster'); 2392 if (posterUrl) { 2393 var sep = posterUrl.indexOf('?') >= 0 ? '&' : '?'; 2394 $(element).prop('poster', posterUrl + sep + 'v=' + Date.now()); 2395 } 2396 } 2397 }); 2398 }else{ 2399 // if($.cookie('auth_token')){ 2400 // $('.lazyDom').each(function() { 2401 // var originalSrc = $(this).data('src'); 2402 // var originalVideoSrc = $(this).find('data-src').attr('src'); 2403 // var newSrc = originalSrc + '?token=' + $.cookie('auth_token'); 2404 // var newVideoSrc = originalVideoSrc + '?token=' + $.cookie('auth_token'); 2405 // if(originalSrc){ 2406 // $(this).attr('data-src', newSrc); 2407 // } 2408 // if(originalVideoSrc){ 2409 // $(this).find('data-src').attr('src', newVideoSrc); 2410 // } 2411 // }); 2412 // } 2413 $('.lazyDom').Lazy({ 2414 bind: 'event', 2415 threshold: 200, 2416 exclude: function(element) {//å¦æè¯¦æ 弹屿²¡å±å¼è¯¦æ å çç»ä»¶ä¸è¿è¡æå è½½ 2417 if($(element).closest('.entranceWraper').css('display') != 'none'){ 2418 return $(element).closest('.entranceWraper').length > 0; 2419 }else{ 2420 return false; 2421 } 2422 }, 2423 customLoaderName: function(element) { 2424 $(element).find('.lazyDom[data-src]').each((v,i)=>{ 2425 var newsrc = $(i).attr('data-src'); 2426 $(i).attr('src',newsrc) 2427 }) 2428 $(element).find('data-src').each((v,i)=>{ 2429 if($(i).parent().hasClass('lazyDom')){ 2430 var dataSrc = $(i).attr('src'); 2431 var sourceElement = $('<source>'); 2432 sourceElement.attr('src', dataSrc); 2433 2434 $(i).before(sourceElement); 2435 $(i).remove(); 2436 } 2437 }) 2438 var v = element.is('video') ? element[0] : element.find('video')[0]; 2439 if (v && v.load) v.load(); 2440 element.load(); 2441 }, 2442 beforeLoad: function(element) { 2443 var posterUrl = $(element).data('poster'); 2444 if (posterUrl) { 2445 $(element).attr('poster', posterUrl); 2446 } 2447 }, 2448 }); 2449 } 2450 }, 2451 showVideoSrcFun: function(type){ 2452 if(type == 'ios'){ 2453 $('.ios-box').each(function(){ 2454 var pcSrc = $(this).data('video-pc')||$(this).parent().data('video-pc'); 2455 var mobileSrc = $(this).data('video-ph')||$(this).parent().data('video-ph'); 2456 if(universalMethods.isMobile){ 2457 if($(this).find('video.phs').hasClass('lazyDomMobile')){ 2458 $(this).find('video.phs data-src').attr('src',mobileSrc) 2459 }else{ 2460 $(this).find('video.phs').attr('src',mobileSrc) 2461 } 2462 if($(this).parent().data('poster-ph')){//é¤08页é¢ä»¥å¤çè§é¢å ¼å®¹ 2463 $(this).find('video').attr('poster',$(this).parent().data('poster-ph')) 2464 } 2465 }else{ 2466 if($(this).find('video.pcs').hasClass('lazyDom')){ 2467 $(this).find('video.pcs data-src').attr('src',pcSrc) 2468 }else{ 2469 $(this).find('video.pcs').attr('src',pcSrc) 2470 } 2471 if($(this).parent().data('poster-pc')){//é¤08页é¢ä»¥å¤çè§é¢å ¼å®¹ 2472 $(this).find('video').attr('poster',$(this).parent().data('poster-pc')) 2473 } 2474 } 2475 }) 2476 } 2477 if(type == 'android'){ 2478 $('.android-box').each(function(){ 2479 var pcSrc = $(this).data('video-pc')||$(this).parent().data('video-pc'); 2480 var mobileSrc = $(this).data('video-ph')||$(this).parent().data('video-ph'); 2481 if(universalMethods.isMobile){ 2482 if($(this).find('video.phs').hasClass('lazyDomMobile')){ 2483 $(this).find('video.phs data-src').attr('src',mobileSrc) 2484 }else{ 2485 $(this).find('video.phs').attr('src',mobileSrc) 2486 } 2487 if($(this).parent().data('poster-ph')){//é¤08页é¢ä»¥å¤çè§é¢å ¼å®¹ 2488 $(this).find('video').attr('poster',$(this).parent().data('poster-ph')) 2489 } 2490 }else{ 2491 if($(this).find('video.pcs').hasClass('lazyDom')){ 2492 $(this).find('video.pcs data-src').attr('src',pcSrc) 2493 }else{ 2494 $(this).find('video.pcs').attr('src',pcSrc) 2495 } 2496 if($(this).parent().data('poster-ph')){//é¤08页é¢ä»¥å¤çè§é¢å ¼å®¹ 2497 $(this).find('video').attr('poster',$(this).parent().data('poster-ph')) 2498 } 2499 } 2500 }) 2501 } 2502 }, 2503 initVideoElement: function(){ 2504 var isWeCom= /wxwork/i.test(navigator.userAgent); // 夿æ¯å¦ä¸ºä¼ä¸å¾®ä¿¡ç±» 2505 var isXiaomi2s = navigator.userAgent.toLowerCase().match(/mix\s/i) == "mix "; 2506 var isXiaomi = navigator.userAgent.toLowerCase().match(/xiaomi/i) == "xiaomi"; 2507 var isRedmi = navigator.userAgent.toLowerCase().match(/redmi/i) == "redmi"; 2508 var isVivo = navigator.userAgent.toLowerCase().match(/vivo/i) == "vivo"; 2509 var isOppo = navigator.userAgent.toLowerCase().match(/oppo/i) == "oppo"; 2510 var isHeytapbrowser = navigator.userAgent.toLowerCase().match(/heytapbrowser/i) == "heytapbrowser"; 2511 var isMiui = navigator.userAgent.toLowerCase().match(/mzbrowser/i) == "mzbrowser"; 2512 var isBaiduMiniProgram = /swan-baiduboxapp|swan\//i.test(navigator.userAgent.toLowerCase()); 2513 if(!universalMethods.isMobile){ 2514 universalMethods.showVideoSrcFun('ios') 2515 $('.ios-box').show().attr('isShow',true) 2516 $('.video-autoplay .icon').hide() 2517 }else{ 2518 if (isWeCom) {//ä¼ä¸å¾®ä¿¡ 2519 //alert('ä¼ä¸å¾®ä¿¡') 2520 universalMethods.showVideoSrcFun('ios') 2521 $('.ios-box').show().attr('isShow',true) 2522 $('.video-autoplay .icon').hide() 2523 }else if(universalMethods.isWechat()){// 微信 2524 //alert('微信') 2525 universalMethods.showVideoSrcFun('android') 2526 $('.android-box').show().attr('isShow',true) 2527 $('.video-autoplay .icon').show() 2528 } else { 2529 if(universalMethods.isiOS()){//ios 2530 //alert('ios') 2531 universalMethods.showVideoSrcFun('ios') 2532 $('.ios-box').show().attr('isShow',true) 2533 $('.video-autoplay .icon').hide() 2534 setTimeout(v=>{ 2535 $('.ios-box video.phs')[0] && $('.ios-box video.phs')[0].play() 2536 },3000) 2537 }else{//å®å 2538 $('.video-autoplay .icon').show() 2539 if(isRedmi || isVivo || isOppo || isHeytapbrowser || isMiui || isXiaomi2s || isXiaomi || isBaiduMiniProgram){//ç¹æ®æºå 2540 console.info(navigator.userAgent.toLowerCase, 'navigator.userAgent.toLowerCase'); 2541 // alert('ç¹æ®æºå') 2542 $('.mz-box').show().attr('isShow',true) 2543 2544 $('.mz-box').each(function(){ 2545 if($(this).parent().data('poster-ph')){//é¤08页é¢ä»¥å¤çè§é¢å ¼å®¹ 2546 $(this).find('.image').attr('src',$(this).parent().data('poster-ph')) 2547 } 2548 }) 2549 }else{//æ®éå®åæº 2550 // alert('æ®éå®åæº') 2551 universalMethods.showVideoSrcFun('android') 2552 $('.android-box').show().attr('isShow',true) 2553 } 2554 } 2555 } 2556 } 2557 if(universalMethods.isMobile){ 2558 universalMethods.videoPlayFun() 2559 } 2560 }, 2561 initVideHeight: function(){ 2562 $('.itemSubTitleM').css('height',window.innerHeight*0.204+'px !important;'); 2563 $('.lcInnerContentM').css('padding-top',window.innerHeight*0.207+'px !important;'); 2564 $('.entranceMoreWraper .toggleContentWraper .swiper-slide, .listContentWraperM ').css('height',window.innerHeight+'px !important;'); 2565 $('.videoToImage, .universalSwiper, .universalKv, .universalMedia, .ScrollingImage').css('height',window.innerHeight+'px'); 2566 $('.toggleContentWraper, .toggleContentWraperP, .toggleContentWraper .swiper-slide, .toggleContentWraperP .swiper-slide, .toggleContentWraper .swiper-wrapper img, .toggleContentWraperP .swiper-wrapper img,.toggleContentWraper video,.toggleContentWraperP video,.toggleContentWraper .black-mask,.toggleContentWraperP .black-mask ').css('height',window.innerHeight+'px') 2567 2568 if(window.innerWidth>750){ 2569 $('.videoToImage-list, .videoToImage-image ').css('height',window.innerHeight+'px'); 2570 } 2571 }, 2572 newsVideoPlay: function(){ 2573 var $videos = $('.newsvideo'); 2574 $videos.on('play', function() { 2575 $videos.not(this).each(function() { 2576 this.pause(); 2577 }); 2578 });
2579 }, 2580 handleAppRoute: function(url) { 2581 if (!url) return; 2582 2583 const urlObj = new URL(url); 2584 const protocol = urlObj.protocol; 2585 let routeType = 'route'; 2586 let routeParams = { 2587 path: '/h5/host', 2588 options: { 2589 h5_index_url: url, 2590 navigationBarHidden: true 2591 } 2592 }; 2593 2594 if (protocol === 'lynkco:' && url.includes('://h5')) { 2595 routeParams = { 2596 url: url, 2597 navigationBarHidden: true 2598 }; 2599 routeType = 'bannerRoute'; 2600 } else if (protocol === 'http:' || protocol === 'https:') { 2601 // æ£å¸¸http/https龿¥ï¼ä¿æåæé»è¾ 2602 } else if (protocol === 'lynkco:' && url.includes('://native')) { 2603 const params = new URLSearchParams(urlObj.search); 2604 const paramsObj = {}; 2605 for (const [key, value] of params.entries()) { 2606 paramsObj[key] = value; 2607 } 2608 const eventParam = `event=${encodeURIComponent(JSON.stringify({ data: paramsObj }))}`; 2609 routeParams = { 2610 url: url, 2611 navigationBarHidden: true 2612 }; 2613 routeType = 'bannerRoute'; 2614 } 2615 2616 console.log('ð å¼å§è·¯ç±è·³è½¬:', routeParams); 2617 2618 // è°ç¨Cordovaæä»¶ 2619 if (window.Cordova && window?.Cordova?.exec) { 2620 window.Cordova.exec( 2621 (result) => console.log('â è·¯ç±è·³è½¬æå:', result), 2622 (error) => console.error('â è·¯ç±è·³è½¬å¤±è´¥:', error), 2623 'SWXRouterPlugin', 2624 routeType, 2625 [routeParams] 2626 ); 2627 } else { 2628 // å è½½SDK 2629 const app_script = document.createElement('script'); 2630 app_script.src = 'https://app-cdn.lynkco.com/cordova/index.v2.js'; 2631 document.head.appendChild(app_script); 2632 app_script.onload = function() { 2633 console.log('app SDKå è½½å®æ'); 2634 document.addEventListener('deviceready', function() { 2635 if (window?.Cordova && window?.Cordova?.exec) { 2636 window.Cordova.exec( 2637 (result) => console.log('â è·¯ç±è·³è½¬æå:', result), 2638 (error) => console.error('â è·¯ç±è·³è½¬å¤±è´¥:', error), 2639 'SWXRouterPlugin', 2640 routeType, 2641 [routeParams] 2642 ); 2643 } 2644 }); 2645 }; 2646 } 2647 }, 2648 bindChannelBtn: function(){ 2649 if(window.location.origin.indexOf('www.lynkco.com.cn') == -1){ 2650 const vConaoleScript = document.createElement('script'); 2651 vConaoleScript.src = 'https://unpkg.com/vconsole@latest/dist/vconsole.min.js'; 2652 vConaoleScript.type = 'text/javascript'; 2653 document.head.appendChild(vConaoleScript); 2654 vConaoleScript.onload = () => { 2655 new window.VConsole(); 2656 } 2657 } 2658 // é¢å APPï¼ QD0001 2659 // é¢å 微信å°ç¨åºï¼ QD0003 2660 // é¢å 汽车æé³å°ç¨åºï¼ 202207192 2661 // é¢å 汽车å°çº¢ä¹¦å°ç¨åºï¼ 202207191 2662 // é¢å 京ä¸å°ç¨åºï¼ lynkcoJD 2663 // é¢å 汽车ç¾åº¦å°ç¨åºï¼ QD20220824 2664 // é¢å 汽车æ¯ä»å®å°ç¨åºï¼ QD220824 2665 // æ´è½¦ååH5ï¼ QD220825 2666 const channelNames = ['é¢å APP', 'é¢å 微信å°ç¨åº', 'é¢å 汽车æé³å°ç¨åº', 'é¢å 汽车å°çº¢ä¹¦å°ç¨åº', 'é¢å 京ä¸å°ç¨åº', 'é¢å 汽车ç¾åº¦å°ç¨åº', 'é¢å 汽车æ¯ä»å®å°ç¨åº', 'æ´è½¦ååH5']; 2667 // é¢å®ä¹çæ¸ éå表 2668 const channelList = ['QD0001', 'QD0003', '202207192', '202207191', 'lynkcoJD', 'QD20220824', 'QD220824', 'QD220825']; 2669 // ä»URLè·åchannelåæ° 2670 const urlParams = new URLSearchParams(window.location.search); 2671 // è·åå½åæ¸ é 2672 const currentChannel = urlParams.get('channel'); 2673 // æ£æ¥æ¸ 鿝å¦å¨åè¡¨ä¸ 2674 if (currentChannel && channelList.includes(currentChannel)) { 2675 // configurator 2676 if (universalMethods.isMobile) { 2677 $('.carConfigPage').stop().animate({paddingTop: '0px', paddingBottom: '1px'},10); 2678 } 2679 const channelShareMsg = { 2680 title: $('#share_title').val(), 2681 desc: $('#share_description').val(), // å享æè¿° 2682 imageUrl: $('#share_image').val(), // å¾ç龿¥ 2683 type: 'use-message-share' 2684 } 2685 // 为å¹é æ¸ éçæé®ç»å®ç¹å»äºä»¶ 2686 $(`.universal-btn.${currentChannel}`).on('click', function(e) { 2687 e.preventDefault(); 2688 const url = $(this).data('channelhref'); 2689 console.info(url, `$(this).data('channelhref')`); 2690 if (!url) { 2691 return; 2692 } 2693 // æ ¹æ®ä¸åçæ¸ é触åä¸åçäºä»¶ 2694 switch(currentChannel) { 2695 case 'QD0001': 2696 // app 2697 const urlObj = new URL(url);
2698 const protocol = urlObj.protocol; 2699 let routeType = 'route'; 2700 let routeParams = { 2701 path: '/h5/host', 2702 options: { 2703 h5_index_url: url, 2704 navigationBarHidden: true 2705 } 2706 }; 2707 if (protocol === 'lynkco:' && url.includes('://h5')) { 2708 //lynkco://h5/?routeUrl=https://h5.lynkco.com/lynkco3-cordova/index.html#/pages/lynkco-test-drive/index 2709 routeParams = { 2710 url: url, 2711 navigationBarHidden: true 2712 }; 2713 routeType = 'bannerRoute'; 2714 } else if (protocol === 'http:' || protocol === 'https:') { 2715 //https://h5.lynkco.com/lynkco3-cordova/index.html#/pages/lynkco-test-drive/index 2716 } else if (protocol === 'lynkco:' && url.includes('://native')) { 2717 // 对äºnativeåè®®ï¼ä½¿ç¨ç¹æ®çåæ°è½¬æ¢ 2718 const urlObj = new URL(url); 2719 const params = new URLSearchParams(urlObj.search); 2720 const paramsObj = {}; 2721 for (const [key, value] of params.entries()) { 2722 paramsObj[key] = value; 2723 } 2724 // æå»ºeventåæ° 2725 const eventParam = `event=${encodeURIComponent(JSON.stringify({ data: paramsObj }))}`; 2726 routeParams = { 2727 //url: urlObj.pathname.includes('//native') ? `lynkco:${urlObj.pathname}?${eventParam}` : `lynkco://native${urlObj.pathname}?${eventParam}`, 2728 url: url, 2729 navigationBarHidden: true 2730 }; 2731 routeType = 'bannerRoute'; 2732 } 2733 console.log('ð å¼å§è·¯ç±è·³è½¬:', routeParams); 2734 // è°ç¨Cordovaæä»¶ 2735 if (window.Cordova && window?.Cordova?.exec) { 2736 window.Cordova.exec( 2737 // success åè° 2738 function(result) { 2739 console.log('â è·¯ç±è·³è½¬æå:', result); 2740 // å¯ä»¥å¨è¿éæ·»å æååçæä½ 2741 }, 2742 // fail åè° 2743 function(error) { 2744 console.error('â è·¯ç±è·³è½¬å¤±è´¥:', error); 2745 // å¯ä»¥å¨è¿éæ·»å 失败åçæä½ 2746 }, 2747 'SWXRouterPlugin', 2748 routeType, 2749 [routeParams] 2750 ); 2751 } else { 2752 // å建scriptæ ç¾å è½½SDK 2753 const app_script = document.createElement('script'); 2754 app_script.src = 'https://app-cdn.lynkco.com/cordova/index.v2.js'; 2755 // å°scriptæ ç¾æ·»å å°é¡µé¢ 2756 document.head.appendChild(app_script); 2757 app_script.onload = function() { 2758 console.log('app SDKå è½½å®æ'); 2759 // SDKå è½½å®æåæ§è¡è·³è½¬ 2760 document.addEventListener('deviceready', function() { 2761 console.info(window.Cordova, `window.Cordova`); 2762 if (window?.Cordova && window?.Cordova?.exec) { 2763 window.Cordova.exec( 2764 // success åè° 2765 function(result) { 2766 console.log('â è·¯ç±è·³è½¬æå:', result); 2767 // å¯ä»¥å¨è¿éæ·»å æååçæä½ 2768 }, 2769 // fail åè° 2770 function(error) { 2771 console.error('â è·¯ç±è·³è½¬å¤±è´¥:', error); 2772 // å¯ä»¥å¨è¿éæ·»å 失败åçæä½ 2773 }, 2774 'SWXRouterPlugin', 2775 routeType, 2776 [routeParams] 2777 ); 2778 }; 2779 }); 2780 } 2781 } 2782 break; 2783 case 'QD0003': 2784 // 微信å°ç¨åºè·³è½¬é»è¾ 2785 // æ£æ¥æ¯å¦å·²åå¨å°ç¨åºå¯¹è±¡ 2786 if (typeof window.jWeixin !== 'undefined' && window?.jWeixin?.miniProgram) { 2787 // 妿已åå¨ï¼ç´æ¥è°ç¨è·³è½¬ 2788 window.jWeixin.miniProgram.navigateTo({ 2789 url: url, 2790 success: function(res) { 2791 console.log('跳转æå:', res); 2792 }, 2793 fail: function(err) { 2794 console.error('跳转失败:', err); 2795 } 2796 }); 2797 return; 2798 } 2799 // å建scriptæ ç¾å è½½SDK 2800 const jWeixin_script = document.createElement('script'); 2801 jWeixin_script.src = 'https://res.wx.qq.com/open/js/jweixin-1.3.2.js'; 2802 // å°scriptæ ç¾æ·»å å°é¡µé¢ 2803 document.head.appendChild(jWeixin_script); 2804 jWeixin_script.onload = function() { 2805 console.log('å°ç¨åºSDKå è½½å®æ'); 2806 // SDKå è½½å®æåæ§è¡è·³è½¬ 2807 if (typeof window.jWeixin !== 'undefined' && window?.jWeixin?.miniProgram) { 2808 window.jWeixin.miniProgram.navigateTo({ 2809 url: url, 2810 success: function(res) { 2811 console.log('跳转æå:', res); 2812 }, 2813 fail: function(err) { 2814 console.error('跳转失败:', err); 2815 } 2816 }); 2817 }; 2818 } 2819 break; 2820 case '202207192': 2821 // æé³å°ç¨åº 2822 // æ£æ¥æ¯å¦å·²åå¨å°ç¨åºå¯¹è±¡ 2823 if (typeof window.tt !== 'undefined' && window?.tt?.miniProgram) { 2824 // 妿已åå¨ï¼ç´æ¥è°ç¨è·³è½¬ 2825 window.tt.miniProgram.navigateTo({ 2826 url: url, 2827 success: function(res) { 2828 console.log('跳转æå:', res); 2829 }, 2830 fail: function(err) { 2831 console.error('跳转失败:', err); 2832 } 2833 }); 2834 return; 2835 } 2836 // å建scriptæ ç¾å è½½SDK 2837 const dy_script = document.createElement('script'); 2838 dy_script.src = 'https://lf1-cdn-tos.bytegoofy.com/goofy/developer/jssdk/jssdk-1.1.0.js'; 2839 // å°scriptæ ç¾æ·»å å°é¡µé¢ 2840 document.head.appendChild(dy_script); 2841 dy_script.onload = function() { 2842 console.log('å°ç¨åºSDKå è½½å®æ'); 2843 // SDKå è½½å®æåæ§è¡è·³è½¬ 2844 if (typeof window.tt !== 'undefined' && window?.tt?.miniProgram) { 2845 window.tt.miniProgram.navigateTo({ 2846 url: url, 2847 success: function(res) { 2848 console.log('跳转æå:', res); 2849 }, 2850 fail: function(err) { 2851 console.error('跳转失败:', err); 2852 } 2853 }); 2854 }; 2855 } 2856 break; 2857 case '202207191':
2858 // å°çº¢ä¹¦å°ç¨åº 2859 // æ£æ¥æ¯å¦å·²åå¨å°ç¨åºå¯¹è±¡ 2860 if (typeof window.xhs !== 'undefined' && window?.xhs?.miniProgram) { 2861 // 妿已åå¨ï¼ç´æ¥è°ç¨è·³è½¬ 2862 window.xhs.miniProgram.navigateTo({ 2863 url: url, 2864 success: function(res) { 2865 console.log('跳转æå:', res); 2866 }, 2867 fail: function(err) { 2868 console.error('跳转失败:', err); 2869 } 2870 }); 2871 return; 2872 } 2873 // å建scriptæ ç¾å è½½SDK 2874 const xhs_script = document.createElement('script'); 2875 xhs_script.src = 'https://fe-static.xhscdn.com/xhs-mp/open/js/xiaohongshu-3.9.3.js'; 2876 // å°scriptæ ç¾æ·»å å°é¡µé¢ 2877 document.head.appendChild(xhs_script); 2878 xhs_script.onload = function() { 2879 console.log('å°ç¨åºSDKå è½½å®æ'); 2880 // SDKå è½½å®æåæ§è¡è·³è½¬ 2881 if (typeof window.xhs !== 'undefined' && window?.xhs?.miniProgram) { 2882 window.xhs.miniProgram.navigateTo({ 2883 url: url, 2884 success: function(res) { 2885 console.log('跳转æå:', res); 2886 }, 2887 fail: function(err) { 2888 console.error('跳转失败:', err); 2889 } 2890 }); 2891 }; 2892 } 2893 break; 2894 case 'lynkcoJD': 2895 // 京ä¸å°ç¨åº 2896 // æ£æ¥æ¯å¦å·²åå¨å°ç¨åºå¯¹è±¡ 2897 if (typeof window.jd !== 'undefined' && window?.jd?.miniProgram) { 2898 // 妿已åå¨ï¼ç´æ¥è°ç¨è·³è½¬ 2899 window.jd.miniProgram.navigateTo({ 2900 url: url, 2901 success: function(res) { 2902 console.log('跳转æå:', res); 2903 }, 2904 fail: function(err) { 2905 console.error('跳转失败:', err); 2906 } 2907 }); 2908 return; 2909 } 2910 // å建scriptæ ç¾å è½½SDK 2911 const jd_script = document.createElement('script'); 2912 jd_script.src = 'https://dm30webimages-uat.lynkco-test.com/New/LynkCoPortal/Content/business/jssdk.js'; 2913 // å°scriptæ ç¾æ·»å å°é¡µé¢ 2914 document.head.appendChild(jd_script); 2915 jd_script.onload = function() { 2916 console.log('å°ç¨åºSDKå è½½å®æ'); 2917 // SDKå è½½å®æåæ§è¡è·³è½¬ 2918 if (typeof window.jd !== 'undefined' && window?.jd?.miniProgram) { 2919 window.jd.miniProgram.navigateTo({ 2920 url: url, 2921 success: function(res) { 2922 console.log('跳转æå:', res); 2923 }, 2924 fail: function(err) { 2925 console.error('跳转失败:', err); 2926 } 2927 }); 2928 }; 2929 } 2930 break; 2931 case 'QD20220824': 2932 // ç¾åº¦å°ç¨åº 2933 // æ£æ¥æ¯å¦å·²åå¨å°ç¨åºå¯¹è±¡ 2934 if (typeof window.swan !== 'undefined' && window?.swan?.webView) { 2935 // 妿已åå¨ï¼ç´æ¥è°ç¨è·³è½¬ 2936 window.swan.webView.navigateTo({ 2937 url: url, 2938 success: function(res) { 2939 console.log('跳转æå:', res); 2940 }, 2941 fail: function(err) { 2942 console.error('跳转失败:', err); 2943 } 2944 }); 2945 return; 2946 } 2947 // å建scriptæ ç¾å è½½SDK 2948 const bd_script = document.createElement('script'); 2949 bd_script.src = 'https://b.bdstatic.com/searchbox/icms/searchbox/js/swan-2.0.31.js'; 2950 // å°scriptæ ç¾æ·»å å°é¡µé¢ 2951 document.head.appendChild(bd_script); 2952 bd_script.onload = function() { 2953 console.info(window.swan, 'å°ç¨åºSDKå è½½å®æ'); 2954 // SDKå è½½å®æåæ§è¡è·³è½¬ 2955 if (typeof window.swan !== 'undefined' && window?.swan?.webView) { 2956 window.swan.webView.navigateTo({ 2957 url: url, 2958 success: function(res) { 2959 console.log('跳转æå:', res); 2960 }, 2961 fail: function(err) { 2962 console.error('跳转失败:', err); 2963 } 2964 }); 2965 }; 2966 } 2967 break; 2968 case 'QD220824': 2969 // æ¯ä»å®å°ç¨åº 2970 // æ£æ¥æ¯å¦å·²åå¨å°ç¨åºå¯¹è±¡ 2971 if (typeof window.my !== 'undefined' && window?.my?.navigateTo) { 2972 // 妿已åå¨ï¼ç´æ¥è°ç¨è·³è½¬ 2973 window.my.navigateTo({ 2974 url: url, 2975 success: function(res) { 2976 console.log('跳转æå:', res); 2977 }, 2978 fail: function(err) { 2979 console.error('跳转失败:', err); 2980 } 2981 }); 2982 return; 2983 } 2984 // å建scriptæ ç¾å è½½SDK 2985 const alipay_script = document.createElement('script'); 2986 alipay_script.src = 'https://appx/web-view.min.js'; 2987 // å°scriptæ ç¾æ·»å å°é¡µé¢ 2988 document.head.appendChild(alipay_script); 2989 alipay_script.onload = function() { 2990 console.log('å°ç¨åºSDKå è½½å®æ'); 2991 // SDKå è½½å®æåæ§è¡è·³è½¬ 2992 if (typeof window.my !== 'undefined' && window?.my?.navigateTo) { 2993 window.my.navigateTo({ 2994 url: url, 2995 success: function(res) { 2996 console.log('跳转æå:', res); 2997 }, 2998 fail: function(err) { 2999 console.error('跳转失败:', err); 3000 } 3001 }); 3002 }; 3003 } 3004 break; 3005 default: 3006 console.log('æªå¤ççæ¸ é:', currentChannel); 3007 } 3008 }); 3009 console.log(`â å·²ä¸ºæ¸ é ${currentChannel} ç»å®ç¹å»äºä»¶`); 3010 switch(currentChannel) { 3011 case 'QD0001': 3012 // app 3013 break; 3014 case 'QD0003': 3015 // 微信å°ç¨åºé»è¾ 3016 // æ£æ¥æ¯å¦å·²åå¨å°ç¨åºå¯¹è±¡ 3017 if (typeof window.jWeixin !== 'undefined' && window?.jWeixin?.miniProgram) { 3018 window.jWeixin.miniProgram.postMessage({ data: channelShareMsg }); 3019 return; 3020 } 3021 // å建scriptæ ç¾å è½½SDK 3022 const jWeixin_script = document.createElement('script'); 3023 jWeixin_script.src = 'https://res.wx.qq.com/open/js/jweixin-1.3.2.js'; 3024 // å°scriptæ ç¾æ·»å å°é¡µé¢ 3025 document.head.appendChild(jWeixin_script); 3026 jWeixin_script.onload = function() { 3027 console.log('å°ç¨åºSDKå è½½å®æ'); 3028 if (typeof window.jWeixin !== 'undefined' && window?.jWeixin?.miniProgram) { 3029 window.jWeixin.miniProgram.postMessage({ data: channelShareMsg }); 3030 }; 3031 } 3032 break; 3033 case '202207192': 3034 // æé³å°ç¨åº 3035 // æ£æ¥æ¯å¦å·²åå¨å°ç¨åºå¯¹è±¡ 3036 if (typeof window.tt !== 'undefined' && window?.tt?.miniProgram) { 3037 try { 3038 window.tt.miniProgram.postMessage({ data: channelShareMsg }); 3039 } catch (error) { 3040 console.info('æé³å°ç¨åº postMessage API è°ç¨å¤±è´¥:', error); 3041 } 3042 return; 3043 } 3044 // å建scriptæ ç¾å è½½SDK 3045 const dy_script = document.createElement('script'); 3046 dy_script.src = 'https://lf1-cdn-tos.bytegoofy.com/goofy/developer/jssdk/jssdk-1.1.0.js'; 3047 // å°scriptæ ç¾æ·»å å°é¡µé¢ 3048 document.head.appendChild(dy_script); 3049 dy_script.onload = function() { 3050 console.log('å°ç¨åºSDKå è½½å®æ'); 3051 if (typeof window.tt !== 'undefined' && window?.tt?.miniProgram) { 3052 try { 3053 window.tt.miniProgram.postMessage({ data: channelShareMsg }); 3054 } catch (error) { 3055 console.info('æé³å°ç¨åº postMessage API è°ç¨å¤±è´¥:', error); 3056 } 3057 }; 3058 } 3059 break; 3060 case '202207191':
3061 // å°çº¢ä¹¦å°ç¨åº 3062 // æ£æ¥æ¯å¦å·²åå¨å°ç¨åºå¯¹è±¡ 3063 if (typeof window.xhs !== 'undefined' && window?.xhs?.miniProgram) { 3064 window.xhs.miniProgram.postMessage({ data: channelShareMsg }); 3065 return; 3066 } 3067 // å建scriptæ ç¾å è½½SDK 3068 const xhs_script = document.createElement('script'); 3069 xhs_script.src = 'https://fe-static.xhscdn.com/xhs-mp/open/js/xiaohongshu-3.9.3.js'; 3070 // å°scriptæ ç¾æ·»å å°é¡µé¢ 3071 document.head.appendChild(xhs_script); 3072 xhs_script.onload = function() { 3073 console.log('å°ç¨åºSDKå è½½å®æ'); 3074 if (typeof window.xhs !== 'undefined' && window?.xhs?.miniProgram) { 3075 window.xhs.miniProgram.postMessage({ data: channelShareMsg }); 3076 }; 3077 } 3078 break; 3079 case 'lynkcoJD': 3080 // 京ä¸å°ç¨åº 3081 // æ£æ¥æ¯å¦å·²åå¨å°ç¨åºå¯¹è±¡ 3082 if (typeof window.jd !== 'undefined' && window?.jd?.miniProgram) { 3083 try { 3084 console.log('å°ç¨åºSDKå·²åå¨'); 3085 if (universalMethods.isiOS()) { 3086 console.info(channelShareMsg, `ios 京ä¸å°ç¨åº channelShareMsg`); 3087 window.jd.miniProgram.postMessage({ data: channelShareMsg }); 3088 } else { 3089 setTimeout(function() { 3090 console.info(channelShareMsg, `android setTimeout 500 京ä¸å°ç¨åº channelShareMsg`); 3091 window.jd.miniProgram.postMessage({ data: channelShareMsg }); 3092 }, 3000); 3093 } 3094 } catch (error) { 3095 console.info('京ä¸å°ç¨åº postMessage API è°ç¨å¤±è´¥:', error); 3096 } 3097 return; 3098 } 3099 // å建scriptæ ç¾å è½½SDK 3100 const jd_script = document.createElement('script'); 3101 jd_script.src = 'https://dm30webimages-uat.lynkco-test.com/New/LynkCoPortal/Content/business/jssdk.js'; 3102 // å°scriptæ ç¾æ·»å å°é¡µé¢ 3103 document.head.appendChild(jd_script); 3104 jd_script.onload = function() { 3105 console.log('å°ç¨åºSDKå è½½å®æ'); 3106 if (typeof window.jd !== 'undefined' && window?.jd?.miniProgram) { 3107 try { 3108 if (universalMethods.isiOS()) { 3109 console.info(channelShareMsg, `京ä¸å°ç¨åº channelShareMsg`); 3110 window.jd.miniProgram.postMessage({ data: channelShareMsg }); 3111 } else { 3112 setTimeout(function() { 3113 console.info(channelShareMsg, `京ä¸å°ç¨åº channelShareMsg`); 3114 window.jd.miniProgram.postMessage({ data: channelShareMsg }); 3115 }, 3000); 3116 } 3117 } catch (error) { 3118 console.info('京ä¸å°ç¨åº postMessage API è°ç¨å¤±è´¥:', error); 3119 } 3120 }; 3121 } 3122 break; 3123 case 'QD20220824': 3124 // ç¾åº¦å°ç¨åº 3125 // æ£æ¥æ¯å¦å·²åå¨å°ç¨åºå¯¹è±¡ 3126 if (typeof window.swan !== 'undefined' && window?.swan?.webView) { 3127 window.swan.webView.postMessage({ data: channelShareMsg }); 3128 return; 3129 } 3130 // å建scriptæ ç¾å è½½SDK 3131 const bd_script = document.createElement('script'); 3132 bd_script.src = 'https://b.bdstatic.com/searchbox/icms/searchbox/js/swan-2.0.31.js'; 3133 // å°scriptæ ç¾æ·»å å°é¡µé¢ 3134 document.head.appendChild(bd_script); 3135 bd_script.onload = function() { 3136 console.info(window.swan, 'å°ç¨åºSDKå è½½å®æ'); 3137 if (typeof window.swan !== 'undefined' && window?.swan?.webView) { 3138 window.swan.webView.postMessage({ data: channelShareMsg }); 3139 }; 3140 } 3141 break; 3142 case 'QD220824': 3143 // æ¯ä»å®å°ç¨åº 3144 // æ£æ¥æ¯å¦å·²åå¨å°ç¨åºå¯¹è±¡ 3145 if (typeof window.my !== 'undefined' && window?.my?.postMessage) { 3146 window.my.postMessage({ data: channelShareMsg }); 3147 return; 3148 } 3149 // å建scriptæ ç¾å è½½SDK 3150 const alipay_script = document.createElement('script'); 3151 alipay_script.src = 'https://appx/web-view.min.js'; 3152 // å°scriptæ ç¾æ·»å å°é¡µé¢ 3153 document.head.appendChild(alipay_script); 3154 alipay_script.onload = function() { 3155 console.log('å°ç¨åºSDKå è½½å®æ'); 3156 if (typeof window.my !== 'undefined' && window?.my?.postMessage) { 3157 window.my.postMessage({ data: channelShareMsg }); 3158 }; 3159 } 3160 break; 3161 default: 3162 console.log('æªå¤ççæ¸ é:', currentChannel); 3163 } 3164 } 3165 }, 3166 scrollBottomBtns: function(){ 3167 $('.universalBottomBtns').each(function() { 3168 var node = $(this); 3169 var nodeTop = node.offset().top; 3170 var nodeHeight = node.outerHeight(); 3171 3172 var scrollTop = $(window).scrollTop(); 3173 var windowHeight = $(window).height(); 3174 const documentHeight = $(document).height(); 3175 const isTop = scrollTop === 0; 3176 const isBottom = scrollTop + windowHeight >= documentHeight - 5; 3177 if (isTop || isBottom) { 3178 node.removeClass('hiddenBtns'); 3179 return; 3180 } 3181 if (isScrolling_bottomBtns) { 3182 node.addClass('hiddenBtns'); 3183 return; 3184 } else { 3185 node.removeClass('hiddenBtns'); 3186 return; 3187 } 3188 });
3189 }, 3190} 3191$(document).ready(function() { 3192 universalMethods.bindChannelBtn(); 3193 universalMethods.newsVideoPlay(); 3194 universalMethods.initVideHeight(); 3195 universalMethods.initVideoElement(); 3196 setTimeout(function(){ 3197 universalMethods.lazyLoadFun(); 3198 universalMethods.inputFocusFun(); 3199 universalMethods.universalMediaSMagic(); 3200 universalMethods.universalKvPosition(); 3201 universalMethods.universalDividerSMagic(); 3202 universalMethods.headerMobileMenuShow(); 3203 universalMethods.universalTextSwiper(); 3204 universalMethods.universalBuildSwiper(); 3205 universalMethods.initVideoToImage(); 3206 universalMethods.initCartSet(); 3207 universalMethods.kvDetailAnimation(); 3208 methodsAll.initOnePageLoad(); 3209 methodsAll.loadMoreModel();//æ¥çæ´å¤æé® 3210 $('body').click(function(event) { 3211 var modal = $(".universalSubHeader"); 3212 if (modal.hasClass('active')) { 3213 modal.removeClass('active'); 3214 } 3215 }); 3216 },100) 3217 if ($('.universalBottomBtns').length) { 3218 $('.universalBottomBtns').prev().css({'paddingBottom': '85px'}); 3219 } 3220 if (!$('.LKheader').length && (window.location.pathname.endsWith('batteryrecovery') || window.location.pathname.endsWith('privacypolicy'))) { 3221 $('body').attr('style', 'padding-top: 0px !important'); 3222 $('.recoveryMain, .news-head').css({'marginTop': 0}); 3223 } 3224}); 3225let isScrolling_bottomBtns = false; 3226let scrollStopTimer_bottomBtns = null; 3227$(window).scroll(_.throttle(function () { 3228 universalMethods.windowScrollHeader(); 3229 universalMethods.titleAnimation(); 3230 isScrolling_bottomBtns = true; 3231 universalMethods.scrollBottomBtns(); 3232 clearTimeout(scrollStopTimer_bottomBtns); 3233 scrollStopTimer_bottomBtns = setTimeout(function() { 3234 isScrolling_bottomBtns = false; 3235 universalMethods.scrollBottomBtns(); 3236 }, 300); 3237}, 50)); 3238 3239$(window).scroll(_.throttle(function () { 3240 universalMethods.kvDetailAnimation(); 3241 if($('.entranceMoreWraper').length){ 3242 methodsAll.allScrollImage(); 3243 } 3244}, 700)); 3245window.history.scrollRestoration = 'auto'; 3246document.addEventListener('DOMContentLoaded', function() { 3247 window.history.scrollRestoration = 'auto'; 3248 if(universalMethods.getUrlParameter('testdriver') || $('.carMain').length==0){ 3249 window.history.scrollRestoration = 'auto'; 3250 }else{ 3251 window.history.scrollRestoration = 'manual'; 3252 } 3253 3254 setTimeout(function(){ 3255 methodsAll.allLoad(); 3256 universalMethods.scrollImage(); 3257 universalMethods.menuScrollTo() 3258 setTimeout(function(){ 3259 universalMethods.toTestDriver(); 3260 },200) 3261 },100) 3262 if($('.carMain').length>0){ 3263 var preloadDiv = []; 3264 $.each($(".detailInfo"), function (i, item) { 3265 if ($(item).attr("data-list")) { 3266 var url = $(item).attr("data-list").split("/"); 3267 var id = url[url.length - 1] || url[url.length - 2]; 3268 preloadDiv.push('<div id="' + id + '"></div>'); 3269 } 3270 }); 3271 //$("#perloadCarDetail").html(preloadDiv.join("")); 3272 $(".detailBody").html(preloadDiv.join("")); 3273 $.each($(".detailInfo"), function (i, item) { 3274 if ($(item).attr("data-list")) { 3275 var url = $(item).attr("data-list").split("/"); 3276 var id = url[url.length - 1] || url[url.length - 2]; 3277 $("#" + id).load($(item).attr("data-list")); 3278 } 3279 }); 3280 //ç§»é¤ç¹å»äºä»¶ 3281 $(".detailInfo").unbind("click"); 3282 //è¯¦æ æé®ç¹å» 3283 $(".detailInfo").click(function () { 3284 var self = $(this); 3285 self.addClass("loading"); 3286 setTimeout(function () { 3287 showDetail(self); 3288 self.removeClass("loading"); 3289 }, 100); 3290 pushTrack('click', $(document).attr('title') + '-' + $.trim($(this).parent().find(".d-title").text())); 3291 }); 3292 } 3293}) 3294 3295 3296window.addEventListener("DOMMouseScroll", universalMethods.scrollFunc) 3297window.addEventListener("wheel", universalMethods.scrollFunc) 3298window.addEventListener("mousewheel", universalMethods.scrollFunc) 3299window.addEventListener("touchstart", universalMethods.touchStartFun) 3300window.addEventListener("touchmove", universalMethods.touchMoveFunc)
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.