Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     let tabHeader = document.querySelectorAll('.tabHeaderClick'),
  2.         tabContent = document.querySelectorAll('.content_slider_info_bg'),
  3.         tabContainer = document.querySelector('.about_game_list'),
  4.         contentSlide = document.querySelectorAll('.tabHeaderItem'),
  5.         tabHeaderIcon = document.querySelectorAll('.tabHeaderIcon'),
  6.         sliderImgPoint = document.querySelectorAll('.vh_slide_img'),
  7.         sliderMenuContainer = document.querySelector('.content_slider_menu'),
  8.         sliderMenu = document.querySelectorAll('.vh_slide_img');
  9.  
  10.  
  11.  
  12.     window.addEventListener('DOMContentLoaded', function () {
  13.         hideTabsContent(1);
  14.     });
  15.  
  16.  
  17.     function hideTabsContent(a) {
  18.         for (let i = a; i < tabContent.length; i++) {
  19.             tabContent[i].classList.remove('visible');
  20.             tabContent[i].classList.add('hidden');
  21.             contentSlide[i].classList.remove('list_active');
  22.             tabHeaderIcon[i].classList.remove('list_active');
  23.             sliderImgPoint[i].classList.remove('on_img_a');
  24.         }
  25.     }
  26.  
  27.     function showTabsContent(b) {
  28.         if (tabContent[b].classList.contains('hidden')) {
  29.             hideTabsContent(0);
  30.             tabContent[b].classList.remove('hidden');
  31.             tabContent[b].classList.add('visible');
  32.             contentSlide[b].classList.add('list_active');
  33.             tabHeaderIcon[b].classList.add('list_active');
  34.             sliderImgPoint[b].classList.add('on_img_a');
  35.         }
  36.     }
  37.  
  38.     tabContainer.addEventListener('click', function (e) {
  39.         let target = e.target;
  40.         if (target.className == 'tabHeaderClick') {
  41.             for (let i = 0; i < tabHeader.length; i++) {
  42.                 if (target == tabHeader[i]) {
  43.                     showTabsContent(i);
  44.                     break;
  45.                 }
  46.             }
  47.         }
  48.     });
  49.  
  50.     sliderMenuContainer.addEventListener('click', function (e) {
  51.         let target = e.target;
  52.         if (target.className == 'vh_slide_img') {
  53.             for (let i = 0; i < sliderMenu.length; i++) {
  54.                 if (target == sliderMenu[i]) {
  55.                     showTabsContent(i);
  56.                     break;
  57.                 }
  58.             }
  59.         }
  60.     });
  61.  
  62.  
  63.     // JQuery Code for change active menu item when user scrolling page and
  64.     // change page position when user click to menu item.
  65.     var lastId,
  66.         topMenu = $("#menuScrollVH"),
  67.         topMenuHeight = topMenu.outerHeight() + 15,
  68.         menuItems = topMenu.find("a"),
  69.         scrollItems = menuItems.map(function () {
  70.             var item = $($(this).attr("href"));
  71.             if (item.length) {
  72.                 return item;
  73.             }
  74.         });
  75.  
  76.     menuItems.click(function (e) {
  77.         var href = $(this).attr("href"),
  78.             offsetTop = href === "#" ? 0 : $(href).offset().top - topMenuHeight + 1;
  79.         $('html, body').stop().animate({
  80.             scrollTop: offsetTop
  81.         }, 300);
  82.         e.preventDefault();
  83.     });
  84.  
  85.     $(window).scroll(function () {
  86.         var fromTop = $(this).scrollTop() + topMenuHeight;
  87.         var cur = scrollItems.map(function () {
  88.             if ($(this).offset().top < fromTop)
  89.                 return this;
  90.         });
  91.         cur = cur[cur.length - 1];
  92.         var id = cur && cur.length ? cur[0].id : "";
  93.  
  94.  
  95.  
  96.         if (lastId !== id) {
  97.             lastId = id;
  98.             menuItems
  99.                 .removeClass("activeVH");
  100.  
  101.             menuItems
  102.                 .filter(`[href="#${id}"]`).addClass("activeVH");
  103.         }
  104.     });
  105.  
  106.  
  107.     //Scroll to point Start
  108.  
  109.     let mBottomArrow = document.querySelector('.to-bottom-arrow');
  110.     mBottomArrow.addEventListener('click', (e) => {
  111.         scrollToT('#m_remastered_top', e, 600);
  112.     });
  113.  
  114.  
  115.     let rem = document.querySelectorAll('.bottom_2zfD');
  116.  
  117.     let linkArr = ["#m_remastered_info", "#m_g_description", "#m_upgradechar", "#m_pvp", "#m_pve"];
  118.  
  119.     for (let i = 0; i < 5; i++) {
  120.         rem[i].addEventListener('click', (e) => {
  121.             scrollToT(linkArr[i], e, 600);
  122.         });
  123.     }
  124.  
  125.     function scrollToT(target, event, delay) {
  126.         let aa = $(target);
  127.         var offsetDownLarge = 88;
  128.         var offsetDownSmall = 13;
  129.         if (aa.length) {
  130.             event.preventDefault();
  131.             var clientWidth = document.body.clientWidth;
  132.             var offset = clientWidth >= 992 ? offsetDownLarge : offsetDownSmall;
  133.             var scroll = aa.offset().top - offset;
  134.             $("html, body").stop().animate({
  135.                 scrollTop: scroll
  136.             }, delay); // Время прокрутки, чем больше, тем медленнее.
  137.         }
  138.     }
  139.  
  140.  
  141.  
  142.     //PoP Up Start
  143.  
  144.     let bagContainer = document.querySelector('.bagsTable'),
  145.         hoverImages = document.querySelectorAll('.m_popUp_description'),
  146.         popUpContainerItem = document.querySelectorAll('.m_popUp_container');
  147.  
  148.     window.addEventListener('DOMContentLoaded', function () {
  149.         hidePopUps(0);
  150.     });
  151.  
  152.  
  153.     function hidePopUps(a) {
  154.         for (let i = a; i < popUpContainerItem.length; i++) {
  155.             popUpContainerItem[i].classList.remove('visible');
  156.             popUpContainerItem[i].classList.add('hidden');
  157.  
  158.         }
  159.     }
  160.  
  161.     function showPopUpContent(b) {
  162.         if (popUpContainerItem[b].classList.contains('hidden')) {
  163.             hidePopUps(0);
  164.             popUpContainerItem[b].classList.remove('hidden');
  165.             popUpContainerItem[b].classList.add('visible');
  166.         }
  167.     }
  168.  
  169.     bagContainer.addEventListener('mouseover', function (e) {
  170.         let target = e.target;
  171.         if (target.className == 'm_popUp_description') {
  172.             for (let i = 0; i < hoverImages.length; i++) {
  173.                 if (target == hoverImages[i]) {
  174.                     showPopUpContent(i);
  175.                     break;
  176.                 }
  177.             }
  178.         }
  179.     });
  180.  
  181.     bagContainer.addEventListener('mouseout', function (e) {
  182.         let target = e.target;
  183.         if (target.className == 'm_popUp_description') {
  184.             for (let i = 0; i < hoverImages.length; i++) {
  185.                 if (target == hoverImages[i]) {
  186.                     hidePopUps(i);
  187.                     break;
  188.                 }
  189.             }
  190.         }
  191.     });
  192.  
  193.    
  194.     function showPopUpDescription (targetId, text) {
  195.        
  196.         let target = document.querySelector(`#${targetId}`);
  197.         let textBlock = document.createElement('div');
  198.         textBlock.classList.add('m_popUp_container2', 'hidden');
  199.         target.parentNode.appendChild(textBlock);
  200.        
  201.        
  202.                
  203.         target.addEventListener('mouseover', (e) => {
  204.             if (textBlock.classList.contains('hidden')) {
  205.                 target.parentNode.appendChild(textBlock);
  206.                 textBlock.classList.remove('hidden');
  207.                 let coords = target.getBoundingClientRect();
  208.                 textBlock.style.left = coords.left + "px";
  209.                 textBlock.style.top = coords.bottom + "px";
  210.                 textBlock.classList.add('visible');
  211.                 textBlock.innerHTML = text;
  212.                 target.style.cursor = 'help';
  213.             }
  214.            
  215.         });
  216.         target.addEventListener('mouseout', (e) => {
  217.             if (textBlock.classList.contains('visible')) {
  218.                 textBlock.classList.remove('visible');
  219.                 textBlock.classList.add('hidden');
  220.                 textBlock.remove();
  221.             }
  222.         });
  223.        
  224.        
  225.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement