app2.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. $(function () {
  2. //给页面绑定滑轮滚动事件
  3. $(document).on('scroll', scrollFunc);
  4. changeTab();
  5. changeCard();
  6. changeTabPage();
  7. //banner 轮播
  8. var bannerSlide = null;
  9. bannerSlide = new Swiper('#bannerSlide .swiper-container', {
  10. centeredSlides: true,
  11. slideToClickedSlide: false,
  12. preventClicksPropagation: true,
  13. loop: true,
  14. autoplay: true,
  15. navigation: {
  16. nextEl: '.swiper-button-next',
  17. prevEl: '.swiper-button-prev',
  18. },
  19. pagination: {
  20. el: '.swiper-pagination',
  21. type: 'custom',
  22. renderCustom: function (swiper, current, total) {
  23. var customPaginationHtml = '';
  24. for (var i = 0; i < total; i++) {
  25. if (i === (current - 1)) {
  26. // if($('.e-commerce-header').length > 0) {
  27. // if(scrollTop <= 10){
  28. // $('.e-commerce-header').css({
  29. // // backgroundImage: "linear-gradient(292deg, #4256e8, #576bff)",
  30. // })
  31. // }
  32. // }
  33. customPaginationHtml += '<div class="slide-page"><div class="item active-slide"></div></div>';
  34. } else {
  35. // if($('.e-commerce-header').length > 0) {
  36. // if(scrollTop <= 10){
  37. // $('.e-commerce-header').css({
  38. // // backgroundImage: "linear-gradient(292deg, #2C64EF,#4589FB)",
  39. // })
  40. // }
  41. // }
  42. customPaginationHtml += '<div class="slide-page"><div class="item"></div></div>';
  43. }
  44. }
  45. return customPaginationHtml;
  46. },
  47. },
  48. on: {
  49. slideChange: function () {
  50. myAnmiate();
  51. $('.slide-page').on("click", function (e) {
  52. e.preventDefault();
  53. e.stopPropagation();
  54. let index = $('.slide-page').index(this);
  55. bannerSlide.slideToLoop(index, 1000, false);//切换到第一个slide,速度为1秒
  56. });
  57. },
  58. }
  59. });
  60. $("#bannerSlide .swiper-container").hover(function () {
  61. bannerSlide.autoplay.stop();
  62. $('.slide-page .item').stop();
  63. }, function () {
  64. bannerSlide.autoplay.start();
  65. myAnmiate();
  66. });
  67. if ($('.slide-page .item').length > 0) {
  68. myAnmiate();
  69. $('.slide-page').on("click", function (e) {
  70. e.preventDefault();
  71. e.stopPropagation();
  72. let index = $('.slide-page').index(this);
  73. bannerSlide.slideToLoop(index, 1000, false);//切换到第一个slide,速度为1秒
  74. });
  75. }
  76. //解决方案 swiperSulutionSlide
  77. var swiperSulutionSlide = null;
  78. swiperSulutionSlide = new Swiper('#swiperSulutionSlide .swiper-container', {
  79. spaceBetween: 20,
  80. centeredSlides: true,
  81. slideToClickedSlide: false,
  82. preventClicksPropagation: true,
  83. // loop: true,
  84. autoplay: false,
  85. navigation: {
  86. nextEl: '.swiper-button-next',
  87. prevEl: '.swiper-button-prev',
  88. },
  89. scrollbar: {
  90. el: '.swiper-scrollbar',
  91. },
  92. });
  93. $("#bannerSlide .swiper-container").hover(function () {
  94. swiperSulutionSlide.autoplay.stop();
  95. }, function () {
  96. swiperSulutionSlide.autoplay.start();
  97. });
  98. //小程序
  99. var swiperSolutionSlide = null;
  100. swiperSolutionSlide = new Swiper('#swiperSolutionSlide .swiper-container', {
  101. centeredSlides: true,
  102. slideToClickedSlide: false,
  103. preventClicksPropagation: true,
  104. autoplay: false,
  105. pagination: {
  106. el: '.swiper-pagination',
  107. clickable: true,
  108. }
  109. });
  110. //app页面案例
  111. var appCaseSlide = null;
  112. if (isPhone() || $('.new-app-case .swiper-slide').length > 5) {
  113. appCaseSlide = new Swiper('#appCaseSlide .swiper-container', {
  114. slidesPerView: 5,
  115. spaceBetween: 20,
  116. centeredSlides: true,
  117. slideToClickedSlide: false,
  118. preventClicksPropagation: true,
  119. loop: true,
  120. autoplay: true,
  121. navigation: {
  122. nextEl: '.swiper-button-next',
  123. prevEl: '.swiper-button-prev',
  124. },
  125. breakpoints: {
  126. 900: {
  127. slidesPerView: 3,
  128. spaceBetween: 16,
  129. }
  130. }
  131. })
  132. $("#appCaseSlide .swiper-container").hover(function () {
  133. appCaseSlide.autoplay.stop();
  134. }, function () {
  135. appCaseSlide.autoplay.start();
  136. });
  137. } else {
  138. $('#appCaseSlide .swiper-container').addClass('swiper-no-swiping')
  139. appCaseSlide = new Swiper('#appCaseSlide .swiper-container', {
  140. slidesPerView: 5,
  141. spaceBetween: 20,
  142. centeredSlides: true,
  143. slideToClickedSlide: false,
  144. preventClicksPropagation: false,
  145. loop: true,
  146. autoplay: false,
  147. noSwiping: true,
  148. breakpoints: {
  149. 900: {
  150. slidesPerView: 3,
  151. spaceBetween: 16,
  152. }
  153. }
  154. })
  155. }
  156. //微信小程序页面案例
  157. if (isPhone()) {
  158. var miniProgramCaseSlide = new Swiper('#miniProgramCaseSlide .swiper-container', {
  159. slidesPerView: 3,
  160. spaceBetween: 24,
  161. centeredSlides: true,
  162. slideToClickedSlide: false,
  163. preventClicksPropagation: false,
  164. loop: true,
  165. autoplay: true,
  166. navigation: {
  167. nextEl: '.swiper-button-next',
  168. prevEl: '.swiper-button-prev',
  169. },
  170. breakpoints: {
  171. 900: {
  172. slidesPerView: 3,
  173. spaceBetween: 16,
  174. }
  175. }
  176. });
  177. $("#miniProgramCaseSlide .swiper-container").hover(function () {
  178. miniProgramCaseSlide.autoplay.stop();
  179. }, function () {
  180. miniProgramCaseSlide.autoplay.start();
  181. });
  182. } else {
  183. $('#miniProgramCaseSlide .swiper-container').addClass('swiper-no-swiping')
  184. var miniProgramCaseSlide = new Swiper('#miniProgramCaseSlide .swiper-container', {
  185. slidesPerView: 3,
  186. spaceBetween: 24,
  187. centeredSlides: true,
  188. slideToClickedSlide: false,
  189. preventClicksPropagation: false,
  190. loop: true,
  191. autoplay: false,
  192. noSwiping: true,
  193. breakpoints: {
  194. 900: {
  195. slidesPerView: 3,
  196. spaceBetween: 16,
  197. }
  198. }
  199. });
  200. }
  201. //web页面案例
  202. var webCaseSlide = new Swiper('#webCaseSlide .swiper-container', {
  203. slidesPerView: 1.5,
  204. spaceBetween: 24,
  205. centeredSlides: true,
  206. slideToClickedSlide: false,
  207. preventClicksPropagation: true,
  208. autoplay: true,
  209. loop: true,
  210. loopedSlides: 5,
  211. navigation: {
  212. nextEl: '.swiper-button-next',
  213. prevEl: '.swiper-button-prev',
  214. },
  215. breakpoints: {
  216. 900: {
  217. slidesPerView: 1.6,
  218. spaceBetween: 16,
  219. }
  220. }
  221. });
  222. $("#webCaseSlide .swiper-container").hover(function () {
  223. webCaseSlide.autoplay.stop();
  224. }, function () {
  225. webCaseSlide.autoplay.start();
  226. });
  227. //互联网 案例
  228. var webInternetCaseSlide = new Swiper('#webInternetCaseSlide .swiper-container', {
  229. slidesPerView: 1.854,
  230. spaceBetween: 24,
  231. centeredSlides: true,
  232. slideToClickedSlide: false,
  233. preventClicksPropagation: true,
  234. autoplay: true,
  235. loop: true,
  236. freeMode: false,
  237. loopedSlides: 5,
  238. navigation: {
  239. nextEl: '.swiper-button-next',
  240. prevEl: '.swiper-button-prev',
  241. },
  242. breakpoints: {
  243. 900: {
  244. slidesPerView: 1.6,
  245. spaceBetween: 16,
  246. }
  247. }
  248. });
  249. $('.internet-case .swiper-slide').hover(function () {
  250. let slideActive = $('.internet-case .swiper-slide-active').attr('slide');
  251. let slide = $(this).attr('slide');
  252. let index = $('.internet-case .swiper-slide').index(this);
  253. if (slideActive === slide) {
  254. $('.internet-case .swiper-slide .case-dec').eq(index).css({
  255. display: 'block',
  256. })
  257. }
  258. }, function () {
  259. $('.internet-case .swiper-slide .case-dec').css({
  260. display: 'none',
  261. })
  262. });
  263. $("#webInternetCaseSlide .swiper-container").hover(function () {
  264. webInternetCaseSlide.autoplay.stop();
  265. }, function () {
  266. webInternetCaseSlide.autoplay.start();
  267. });
  268. //流程
  269. var flowNav = new Swiper('#flowNav', {
  270. slidesPerView: $('#flowNav .swiper-slide').length,
  271. speed: 700,
  272. autoplay: true,
  273. watchSlidesVisibility: true,/*避免出现bug*/
  274. });
  275. var flowContent = new Swiper('#flowContent', {
  276. autoplay: true,
  277. speed: 700,
  278. watchSlidesVisibility: true,/*避免出现bug*/
  279. thumbs: {
  280. swiper: flowNav,
  281. },
  282. breakpoints: {
  283. 900: {
  284. pagination: {
  285. el: '#flowContent .swiper-pagination',
  286. },
  287. }
  288. }
  289. });
  290. $(".flow-slide").hover(function () {
  291. flowNav.autoplay.stop();
  292. flowContent.autoplay.stop();
  293. }, function () {
  294. flowNav.autoplay.start();
  295. flowContent.autoplay.start();
  296. })
  297. $(document).on('click', '.header-menu a[href^="#"]', function (event) {
  298. event.preventDefault();
  299. $('html, body').animate({
  300. scrollTop: $($.attr(this, 'href')).offset().top - 80
  301. }, 1000);
  302. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  303. $('.header-menu').slideToggle("1000");
  304. $('.menu-toggle').toggleClass('active');
  305. }
  306. });
  307. $('.menu-toggle').click(function () {
  308. event.preventDefault();
  309. $(this).toggleClass('active');
  310. $('.header-menu').slideToggle("1000");
  311. })
  312. //新app - 自定义滚动条
  313. if ($('.app-wrap')) {
  314. scrollBar();
  315. }
  316. //App
  317. if ($('#closed-footer-form').length > 0) {
  318. footerMin();
  319. }
  320. });
  321. //新app页面自定义滚动条
  322. function scrollBar() {
  323. let scrollElement = $('.section-service-process .service-list-warp');
  324. //获取内容的宽
  325. var contentWidth = $('.section-service-process .service-list').width();
  326. //可视区的宽
  327. var clientWidth = scrollElement.width();
  328. //比例
  329. var proportion = clientWidth / contentWidth;
  330. //滚动条的总宽度 ---- 外层轨道
  331. var scrollWidth = $('.section-service-process .scroll-box').width();
  332. //设置内层轨道的宽度
  333. $('.scroll-box .scroll-step').css({
  334. width: scrollWidth * proportion,
  335. });
  336. //内容最大滚动距离
  337. var contentMaxScrollLeft = contentWidth - clientWidth;
  338. scrollElement.on('scroll', function () {
  339. //内容滚动的left值
  340. let scrollLeft = scrollElement.scrollLeft();
  341. //设置滚动条外层轨道的滚动距离 - left
  342. $('.scroll-box .scroll-step').css({
  343. left: scrollLeft / contentMaxScrollLeft * (scrollWidth - $('.scroll-box .scroll-step').width()),
  344. })
  345. })
  346. }
  347. //电商平台
  348. function scrollFunc() {
  349. var scrollTop = document.documentElement.scrollTop || document.body.scrollTop || window.pageYOffset;
  350. var sectionMore = document.getElementById('section-more-container');
  351. if (sectionMore) {
  352. if (scrollTop >= 176) {
  353. sectionMore.style.bottom = '150px';
  354. } else {
  355. sectionMore.style.bottom = scrollTop - 26 + "px";
  356. }
  357. }
  358. if (scrollTop > 0) {
  359. $('.e-commerce-header').css({
  360. backgroundImage: "linear-gradient(292deg, #4256e8, #576bff)",
  361. })
  362. } else {
  363. $('.e-commerce-header').css({
  364. backgroundImage: 'none',
  365. })
  366. }
  367. }
  368. //物联网-覆盖业务
  369. function changeTab() {
  370. let tabTop = $('.internet-work .solution-list-mobile-top .tab');
  371. let itemTop = $('.section-business-dec-top .section-business-item');
  372. tabTop.on('click', function () {
  373. tabTop.removeClass('active');
  374. itemTop.removeClass('active-content');
  375. $(this).addClass('active');
  376. let index = tabTop.index(this);
  377. itemTop.eq(index).addClass('active-content');
  378. });
  379. let tabBottom = $('.internet-work .solution-list-mobile-bottom .tab');
  380. let itemBottom = $('.section-business-dec-bottom .section-business-item');
  381. tabBottom.on('click', function () {
  382. tabBottom.removeClass('active');
  383. itemBottom.removeClass('active-content');
  384. let index = tabBottom.index(this);
  385. $(this).addClass('active');
  386. itemBottom.eq(index).addClass('active-content');
  387. });
  388. //动态设置tab的高度 高度等于宽度
  389. var width = tabTop.width();
  390. tabTop.css({
  391. height: width,
  392. });
  393. tabBottom.css({
  394. height: width,
  395. });
  396. }
  397. //电商 -- 解决方案
  398. function changeCard() {
  399. var items = $('.e-commerce-section-solution .solution-item .top');
  400. var wraps = $('.e-commerce-section-solution .solution-item .wrap');
  401. var filterBlur = $('.e-commerce-section-solution .solution-item .solution-filter-blur');
  402. items.on('mouseenter', function () {
  403. let index = items.index(this);
  404. filterBlur.removeClass("activeblur");
  405. filterBlur.eq(index).addClass('activeblur');
  406. wraps.removeClass('active');
  407. wraps.eq(index).addClass('active');
  408. });
  409. }
  410. //电商 -- 零售系统
  411. function changeTabPage() {
  412. var tabs = $('.section-e-commerce-system .content-list .content-item');
  413. var tabsContent = $('.section-e-commerce-system .content-dec .item-dec');
  414. var left = tabs.length > 0 && tabs[0].offsetWidth / 2 + tabs[0].offsetLeft / 2;
  415. $('.section-e-commerce-system .content-dec .arrow-top').css({
  416. left: left,
  417. });
  418. tabs.on('click', function () {
  419. tabsContent.removeClass('active');
  420. let index = tabs.index(this);
  421. tabsContent.eq(index).addClass('active');
  422. if (index == 0) {
  423. $('.section-e-commerce-system .content-dec .arrow-top').css({
  424. left: left - 5,
  425. });
  426. }
  427. left = tabs[index].offsetWidth / 2 + tabs[index].offsetLeft + tabs[0].offsetLeft / 2;
  428. $('.section-e-commerce-system .content-dec .arrow-top').css({
  429. left: left - 5,
  430. })
  431. })
  432. }
  433. //App footer最小化
  434. function footerMin() {
  435. $('#closed-footer-form').on('click', function () {
  436. $(this).parent().hide();
  437. $('.min-footer-form-div').show();
  438. $('.internet-footer-empty-div').css({
  439. height: "0px"
  440. })
  441. });
  442. $('.min-footer-form-div').on('click', function () {
  443. $(this).hide();
  444. $('#closed-footer-form').parent().show();
  445. $('.internet-footer-empty-div').css({
  446. height: "166px"
  447. })
  448. });
  449. }
  450. function myAnmiate() {
  451. for (var i = 0; i < $('.slide-page .item').length; i++) {
  452. if ($($('.slide-page .item')[i]).hasClass("active-slide")) {
  453. $($('.slide-page .item')[i]).animate({
  454. width: "70px"
  455. }, 3000, "linear")
  456. }
  457. }
  458. }
  459. //新的小程序
  460. $('.solution-section-mini-program .slider-item').on('mouseenter',function(){
  461. let index = $(this).index();
  462. let bgImg = 'content-bg-0' + (index+1);
  463. $('.solution-section-mini-program #content').removeClass();
  464. $('.solution-section-mini-program #content').addClass(bgImg);
  465. $('.solution-section-mini-program #content').addClass("content");
  466. $('.solution-section-mini-program .slider-item').removeClass('active');
  467. $(this).addClass('active');
  468. $('.solution-section-mini-program .item-dec').removeClass('active');
  469. $('.solution-section-mini-program .item-dec').eq(index).addClass('active');
  470. });
  471. //
  472. //
  473. var liDom = $("#case-content-box .case-nav li");
  474. var caseListDom = $("#case-content-box .case-list");
  475. liDom.on('click',function(){
  476. liDom.removeClass('active');
  477. $(this).addClass('active');
  478. var index = $(this).index();
  479. caseListDom.css({
  480. display:"none"
  481. });
  482. caseListDom.eq(index).css({
  483. display:'block'
  484. })
  485. });
  486. //左侧了解更多
  487. $('#section-slide .btn-list a').on('mouseenter',function(){
  488. $('#section-slide .btn-list a').removeClass('active');
  489. $(this).addClass('active');
  490. });