// TODO: ↓↓↓ remove this script ↓↓↓ // Current menu item highlithing $(function () { var location = window.location.href; var cur_url = location.split('/').pop(); $('.top-nav li, .mobile-top-nav li, .footer-nav li').each(function () { var link = $(this).find('a').attr('href'); // console.log(link); if (cur_url == '') { cur_url = 'index.html'; } if (cur_url == link) { $(this).addClass('current-menu-item'); $(this).parents('li').addClass('current-menu-parent'); } }); }); document.addEventListener('DOMContentLoaded', function(){ const isRTL = $('html').attr('dir') == 'rtl'; const isMobile = $(window).width() < 992; function getMobileOperatingSystem() { var userAgent = navigator.userAgent || navigator.vendor || window.opera; // Windows Phone must come first because its UA also contains "Android" if (/windows phone/i.test(userAgent)) { return "windows-phone"; } if (/android/i.test(userAgent)) { return "android"; } // iOS detection from: http://stackoverflow.com/a/9039885/177710 if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) { return "ios"; } return "unknown"; } $('body').addClass("agent-" + getMobileOperatingSystem()); $('.language-select-block').each(function(i, cmp){ $(cmp).find('.block-opener').click(function(e){ e.preventDefault(); $(cmp).toggleClass('opened'); }); $(document).on('mouseup', function(e){ const div = $( cmp ); if ( !div.is(e.target) && div.has(e.target).length === 0 ) { $(cmp).removeClass('opened'); } }); }); // navigator-nav $('.navigator-nav, .navigator-category-block .block-nav').each(function(i, nav){ $(nav).find('.current-menu-parent').addClass('opened').find('> .sub-menu').stop().slideToggle(300); $(nav).find('.menu-item-has-children > a').click(function(e){ e.preventDefault(); e.stopPropagation(); $(this).parent().toggleClass('opened').find('> ul').stop().slideToggle(300) }); }); // Forms $('.select-field select').on('change', function(e){ $(this).addClass('active'); }); // Home first screen $('.first-screen-image-1').addClass('active'); // Home directions $('.directions-sticky-items-block').each(function(i, cmp){ $(cmp).find('.item-content-card').each(function(j, item){ $(item).attr('data-index', j); }); $(cmp).find('.item-content-card').each(function(i, item){ $(window).scroll(function(){ if( $(window).scrollTop() + $(window).height() * 0.5 > $(item).offset().top ){ $(cmp).find('.block-images .item-image').eq( $(item).data('index') ).addClass('active').siblings().removeClass('active'); return; } }); }); }); // Tabs wrapper $('.tabs-nav-wrapper').each(function(i, cmp){ const content = $(cmp).find('.tabs-nav-scrollable-content'); const scroll = $(cmp).find('.cmp-scroll'); const scrollBar = $(scroll).find('.bar'); if (content[0].scrollWidth <= content.outerWidth()) { $(cmp).addClass('disabled-scroll'); } else{ $(cmp).removeClass('disabled-scroll'); } $(window).scroll(function(){ if (content[0].scrollWidth <= content.outerWidth()) { $(cmp).addClass('disabled-scroll'); } else{ $(cmp).removeClass('disabled-scroll'); } }); content.on('scroll', function(){ scrollBar.css({ left: content.scrollLeft() * ((scroll.outerWidth() - scrollBar.outerWidth()) * 100 / scroll.outerWidth()) / (content[0].scrollWidth - content.outerWidth()) + '%' }) }); }); // Phone mask if ($('.js-phone-mask').length > 0) { $('.js-phone-mask input').intlTelInput({ preferredCountries: ['au', 'us', 'gb'], utilsScript: 'utils.js', nationalMode: false, separateDialCode: true, initialCountry: "auto", geoIpLookup: function(success, failure) { $.get("https://ipinfo.io", function() {}, "jsonp").always(function(resp) { const countryCode = (resp && resp.country) ? resp.country : "us"; success(countryCode); }); }, }); } // Steps $('.history-component .item').each(function(i, step){ $(window).scroll(function(){ if( $(window).scrollTop() + $(window).height() * 0.5 > $(step).offset().top ){ $(step).addClass('active'); } }); }); $('.steps-component .step-card').each(function(i, step){ $(window).scroll(function(){ if( $(window).scrollTop() + $(window).height() * 0.5 > $(step).offset().top ){ $(step).addClass('active'); } }); }); $('.serious-section').each(function(i, section){ $(window).scroll(function(){ if( $(window).scrollTop() + $(window).height() * 0.5 > $(section).offset().top ){ $(section).addClass('active'); } }); }); $('.trade-app-block').each(function(i, block){ $(block).find('.block-platforms .item').each(function(j, item){ $(item).css({ transitionDelay: (j * 0.3) + 's' }); }); $(window).scroll(function(){ if( $(window).scrollTop() + $(window).height() * 0.5 > $(block).offset().top ){ $(block).find('.block-platforms .item').addClass('active'); } }); }); $('.join-a-community-section').each(function(i, section){ $(section).find('.section-features li').each(function(j, item){ $(item).css({ transitionDelay: (j * 0.3) + 's' }); }); $(window).scroll(function(){ if( $(window).scrollTop() + $(window).height() * 0.5 > $(section).offset().top ){ $(section).find('.section-features li').addClass('active'); } }); }); // direction-card $('.direction-card').each(function(i, card){ let isPlaying = false; $(window).scroll(function(){ if (isPlaying) return; if( $(window).scrollTop() + $(window).height() * 0.5 > $(card).offset().top ){ isPlaying = true; $(card).find('video').each((j, video) => { video.play(); }) } }); }); // .empower-component $('.empower-component').each(function(i, cmp){ $(cmp).find('.cmp-nav .item').each((j, item) => { $(item).attr('data-index', j); }); $(cmp).find('.cmp-nav .item').on('mouseenter click', function(e){ $(this).addClass('active').siblings().removeClass('active'); $(cmp).find('.cmp-images img').eq( +$(this).data('index') ) .addClass('active').siblings().removeClass('active'); $(cmp).find('.cmp-mobile-slides .slide').eq( +$(this).data('index') ) .stop().fadeIn(300).siblings().hide(0); $(this).find('.item-text').stop().slideDown(300); $(this).siblings().find('.item-text').stop().slideUp(300); }); setTimeout(function(){ $(cmp).find('.cmp-nav .item').eq(0).trigger('click'); }, 100); }); // Calc $('.calc-component').each(function(i, cmp){ const profitEl = $(cmp).find('.js-profit'); const feeEl = $(cmp).find('.js-fee'); const rangeEls = $(cmp).find('input[type="range"]'); console.log(rangeEls); const totalEl = $(cmp).find('.js-total'); rangeEls.each(function(i, el){ const bindedEl = $(el).closest('.cmp-row').find('.js-value'); bindedEl.text( $(el).val() ); totalEl.text( (profitEl.val() * feeEl.val() / 100).toFixed(2) ); }); rangeEls.on('change mousemove', function(){ const bindedEl = $(this).closest('.cmp-row').find('.js-value'); bindedEl.text( $(this).val() ); totalEl.text( (profitEl.val() * feeEl.val() / 100).toFixed(2) ); }); jcf.setOptions('Range', { range: 'min' }); jcf.replace( rangeEls ); }); // tools-benefits-section if ($(window).width() >= 992) { $('.tools-benefits-section').each(function(i, cmp){ $(cmp).find('.benefits-list li').hover(function(){ const type = $(this).data('type'); $(cmp).find('.section-image .type-' + type).addClass('active').siblings().removeClass('active'); $(this).addClass('active').siblings().removeClass('active'); }); $(cmp).find('.benefits-list li:first-child').trigger('mouseenter'); }); } // Team function calculateTeamCardsHeight(){ $('.team-card').each(function(i, el){ $(el).find('.card-body').css({ height: $(el).find('.card-content').outerHeight() }); $(el).attr('data-content-height', $(el).find('.card-content').outerHeight()); }); } calculateTeamCardsHeight(); $('.js-recalc-height').click(calculateTeamCardsHeight); $(window).resize(calculateTeamCardsHeight); $('body').on('mouseenter', '.team-card', function(){ $(this).find('.card-body').css({ height: '100%' }); $(this).find('.card-hidden-content').stop().slideDown(300); }); $('body').on('mouseleave', '.team-card', function(){ $(this).find('.card-body').css({ height: $(this).data('content-height') + 'px' }); $(this).find('.card-hidden-content').stop().slideUp(300); }); // Trading central cards function calculateTradingCentralCardsHeight(){ $('.trading-central-direction-card').each(function(i, el){ $(el).find('.card-body').css({ height: $(el).find('.card-content').outerHeight() }); $(el).attr('data-content-height', $(el).find('.card-content').outerHeight()); }); } calculateTradingCentralCardsHeight(); $('.js-recalc-height').click(calculateTradingCentralCardsHeight); $(window).resize(calculateTradingCentralCardsHeight); $('body').on('mouseenter', '.trading-central-direction-card', function(){ $(this).find('.card-body').css({ height: '100%' }); $(this).find('.card-hidden-content').stop().slideDown(300); }); $('body').on('mouseleave', '.trading-central-direction-card', function(){ $(this).find('.card-body').css({ height: $(this).data('content-height') + 'px' }); $(this).find('.card-hidden-content').stop().slideUp(300); }); // Locations function calculateLocationCardsHeight(){ $('.location-card').each(function(i, el){ $(el).find('.card-body').css({ height: $(el).find('.card-content').outerHeight() }); $(el).attr('data-content-height', $(el).find('.card-content').outerHeight()); }); } calculateLocationCardsHeight(); $(window).resize(calculateLocationCardsHeight); $('body').on('mouseenter', '.location-card', function(){ $(this).find('.card-body').css({ height: '100%' }); $(this).find('.card-hidden-content').stop().slideDown(300); }); $('body').on('mouseleave', '.location-card', function(){ $(this).find('.card-body').css({ height: $(this).data('content-height') + 'px' }); $(this).find('.card-hidden-content').stop().slideUp(300); }); // Filter block $('.filter-block').each(function(i, el){ const selectEl = $(el).find('select'); const textEl = $(el).find('.field-text'); $(el).append('
'); const optionsList = $(el).find('.block-hidden-content ul'); optionsList.click(e => e.stopPropagation()); selectEl.find('option').each(function(j, option){ if ($(option).attr('value') === '-1') return; optionsList.append(`
  • `); }); $(optionsList).on('click', 'button', function(e){ e.preventDefault(); textEl.text( e.target.textContent ); selectEl.val( $(e.target).data('value') ).trigger('change'); selectEl[0].dispatchEvent(new Event('change', { 'bubbles': true })); $(el).removeClass('active'); }); $(el).click(function(e){ $(this).toggleClass('active'); }); $(document).on('mouseup', function(e){ const div = $( el ); if ( !div.is(e.target) && div.has(e.target).length === 0 ) { $(el).removeClass('active'); } }); }); // Accordions const toggleAccordion = (el) => { let closeText = 'Close accordion'; let openText = 'Open accordtion'; let btn = $(el).find('> .ac-header > .ac-opener'); $(el).find('> .ac-content').stop().slideToggle(300); $(el).toggleClass('opened'); if ( $(el).find('.slick-slider').length > 0 ) { $(el).find('.slick-slider').slick('setPosition'); } if ( btn.attr('aria-expanded') == 'false' ) { btn.attr({ 'aria-expanded': 'true', 'aria-label': closeText }); } else{ btn.attr({ 'aria-expanded': 'false', 'aria-label': openText }); } } $('.accordion, .js-accordion, .js-md-accordion').each(function(i, el){ if ($(el).hasClass('js-md-accordion') && $(window).width() >= 992) return; $(el).find('> .ac-header, > .ac-header > .ac-opener').click(function(e){ e.preventDefault(); e.stopPropagation(); toggleAccordion( $(el) ); }); $(el).find('> .ac-header a').click(e => e.stopPropagation()); if ($(el).hasClass('opened-on-load')) { $(el).find('.ac-header').trigger('click'); } }); // Possibility cards $('.mobile-possibility-card').each(function(i, card){ const opener = $(card).find('.js-opener'); const closeText = $(opener).data('close-text'); const openText = $(opener).data('open-text'); let isOpened = false; opener.click(function(e){ e.preventDefault(); isOpened = !isOpened; $(card).find('.card-hidden-content').stop().slideToggle(300); if (isOpened) { $(opener).text(closeText); } else{ $(opener).text(openText); } }); }); // Sliders function equalSlideHeight(slider){ $(slider).on('setPosition', function () { $(this).find('.slick-slide').height('auto'); var slickTrack = $(this).find('.slick-track'); var slickTrackHeight = $(slickTrack).height(); $(this).find('.slick-slide').css('height', slickTrackHeight + 'px'); }); } let arrowsButtons = { prevArrow: '', nextArrow: '' } // First screen $('.first-screen-slider').each(function(i, slider){ const defaults = { rtl: isRTL, slidesToShow: 1, slidesToScroll: 1, swipe: false, fade: true, dots: false, arrows: false, accessibility: false, draggable: false, touchMove: false }; let additional = {}; if ($(slider).is('.adaptive-height')) { additional = { ...additional, adaptiveHeight: true } } $(slider).slick({ ...defaults, ...additional }); }); //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // window.__init_tm_pairs_slider__ = ()=>{ $('.discover-block').each(function(i, cmp){ const scope = $(cmp).closest('.js-discover-slider-scope'); $(cmp).find('.block-slider').slick({ rtl: isRTL, slidesToShow: 3, slidesToScroll: 1, arrows: true, ...arrowsButtons, infinite: false, appendArrows: $(scope).find('.section-nav'), dots: false, responsive: [ { breakpoint: 768, settings: { slidesToShow: 2 } }, { breakpoint: 576, settings: { slidesToShow: 1, appendArrows: $(cmp).find('.block-nav'), } } ] }); }); // }; //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $('.featured-on-slider-wrapper').each(function(i, cmp){ const slider = $(cmp).find('.featured-on-slider'); slider.slick({ rtl: isRTL, slidesToShow: 5, slidesToScroll: 1, dots: false, arrows: false, ...arrowsButtons, centerMode: true, centerPadding: 0, responsive: [ { breakpoint: 992, settings: { arrows: true, slidesToShow: 3, appendArrows: $(cmp).find('.slider-nav') } } ] }); equalSlideHeight(slider); }); //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // window.__init_pairs_slider__ = ()=>{ $('.pairs-slider-wrapper').each(function(i, cmp){ const slider = $(cmp).find('.pairs-slider'); slider.slick({ rtl: isRTL, slidesToShow: 5, slidesToScroll: 1, dots: false, arrows: true, appendArrows: $(cmp).find('.slider-nav'), ...arrowsButtons, infinite:false, responsive: [ { breakpoint: 1200, settings: { slidesToShow: 4, appendArrows: $(cmp).find('.slider-nav') } }, { breakpoint: 992, settings: { slidesToShow: 3, appendArrows: $(cmp).find('.slider-nav') } }, { breakpoint: 768, settings: { slidesToShow: 4, appendArrows: $(cmp).find('.slider-nav') } }, { breakpoint: 576, settings: { slidesToShow: 3, appendArrows: $(cmp).find('.slider-nav') } } ] }); equalSlideHeight(slider); }); // }; //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $('.market-fees-scope').each(function(i, cmp){ const slider = $(cmp).find('.market-fees-slider'); slider.slick({ rtl: isRTL, slidesToShow: 5, slidesToScroll: 1, dots: false, arrows: true, appendArrows: $(cmp).find('.section-header .slider-nav'), ...arrowsButtons, responsive: [ { breakpoint: 1200, settings: { slidesToShow: 4 } }, { breakpoint: 992, settings: { slidesToShow: 3 } }, { breakpoint: 768, settings: { slidesToShow: 2, appendArrows: $(cmp).find('.section-slider .slider-nav'), } } ] }); equalSlideHeight(slider); }); $('.how-to-steps-slider-wrapper').each(function(i, cmp){ if ($(window).width() > 768) return; const slider = $(cmp).find('.how-to-steps-slider'); let additionalOptions = {}; if ($(cmp).hasClass('big')) { additionalOptions = { responsive: [ { breakpoint: 768, settings: { slidesToShow: 2 } }, { breakpoint: 576, settings: { slidesToShow: 1 } } ] } } if ($(cmp).hasClass('how-to-apply')) { additionalOptions = { responsive: [ { breakpoint: 768, settings: { slidesToShow: 2 } }, { breakpoint: 576, settings: { slidesToShow: 2 } } ] } } slider.slick({ infinite: false, rtl: isRTL, slidesToShow: 2, slidesToScroll: 1, dots: false, arrows: true, appendArrows: $(cmp).find('.slider-nav'), ...arrowsButtons, ...additionalOptions }); equalSlideHeight(slider); }); $('.empower-slider-wrapper').each(function(i, cmp){ const slider = $(cmp).find('.empower-slider'); slider.slick({ rtl: isRTL, slidesToShow: 1, slidesToScroll: 1, dots: false, arrows: true, appendArrows: $(cmp).find('.slider-nav'), ...arrowsButtons }); equalSlideHeight(slider); }); $('.testimonials-slider-wrapper').each(function(i, cmp){ const slider = $(cmp).find('.testimonials-slider'); slider.slick({ rtl: isRTL, slidesToShow: 3, slidesToScroll: 1, dots: false, arrows: true, appendArrows: $(cmp).find('.slider-nav'), ...arrowsButtons, responsive: [ { breakpoint: 992, settings: { slidesToShow: 2 } } ] }); equalSlideHeight(slider); }); $('.reviews-slider-wrapper').each(function(i, cmp){ const slider = $(cmp).find('.reviews-slider'); slider.slick({ rtl: isRTL, slidesToShow: 3, slidesToScroll: 1, dots: false, arrows: true, appendArrows: $(cmp).find('.slider-nav'), ...arrowsButtons, responsive: [ { breakpoint: 1200, settings: { slidesToShow: 2 } }, { breakpoint: 768, settings: 'unslick' } ] }); equalSlideHeight(slider); }); // News slider $('.big-news-slider-wrapper').each(function(i, el){ $(el).find('.big-news-slider').slick({ rtl: isRTL, slidesToShow: 1, slidesToScroll: 1, arrows: true, ...arrowsButtons, appendArrows: $(el).find('.slider-nav'), speed: 800 }); equalSlideHeight( $(el).find('.big-news-slider') ); }); // Tabs function goToTab(tabSelector, handler){ if (handler == undefined) { handler = false; } let dest = $( tabSelector ); dest.stop().fadeIn(300).siblings(':not('+tabSelector+')').hide(0); $('[data-tab="'+tabSelector+'"]').addClass('current').siblings(':not('+tabSelector+')').removeClass('current'); setTimeout(function(){ dest.find('.slick-slider').slick('setPosition'); }, 300); } $('[data-nav-to]').each(function(i, nav){ $(nav).find('[data-tab]').each(function(j, item){ $(item).attr('data-slide-index', j); }) }); ////!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ////!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ////!!!!!! added :not(a) special for markets pages $("[data-tab]:not(.a)").click(function(e){ ////!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ////!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! e.preventDefault(); let dest = $(this).data('tab'); const tabsNav = $(this).closest('.tabs-nav'); if (tabsNav.is('[data-nav-to]')) { const bindedSelector = tabsNav.data('nav-to'); //$(bindedSelector).slick('slickGoTo', $(this).data('slide-index')); } if (!!$(this).data('hide')) { $( $(this).data('hide') ).stop().slideUp(300); } goToTab(dest, $(this)); // $(dest).find('.slick-slider').slick('setPosition'); }); $(".tabs-nav, .js-tabs-nav").each(function(i, el){ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! let current = $(el).find('[data-tab].current').eq(0); if(current.length){ current.click(); }else { $(el).find('[data-tab]').eq(0).click(); } //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! }); $('.tabs-select').on('change', function(){ goToTab($(this).val()); }); function getMaxOfArray(numArray) { return Math.max.apply(null, numArray); } //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! window.__init_symbols_table__ = () => { // Tables $('.table').each(function(i, table){ $(table).find('.cell-opener').click(function(e){ e.preventDefault(); $(this).closest('tr').next('.js-nested-table').toggle(); $(this).toggleClass('opened'); }); }); }; //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // Footer nav let isFooterNavMobileView = false; if ($(window).width() < 576) { isFooterNavMobileView = true; } $(window).resize(function(){ if ($(window).width() < 576) { isFooterNavMobileView = true; } else{ isFooterNavMobileView = false; } }); $('.footer-nav .menu-item-has-children > a').click(function(e){ if (!isFooterNavMobileView) return; e.preventDefault(); e.stopPropagation(); $(this).parent().toggleClass('opened'); $(this).siblings('.sub-menu').stop().slideToggle(300); }); $('.footer-nav a').click(e => e.stopPropagation()); // Header nav let isHeaderNavMobileView = false; if ($(window).width() < 992) { isHeaderNavMobileView = true; } $(window).resize(function(){ if ($(window).width() < 992) { isHeaderNavMobileView = true; } else{ isHeaderNavMobileView = false; } }); $('.mobile-top-nav .menu-item-has-children > a').click(function(e){ if (!isHeaderNavMobileView) return; e.preventDefault(); e.stopPropagation(); $(this).parent().toggleClass('opened'); $(this).siblings('.sub-menu').stop().slideToggle(300); }); $('.mobile-top-nav a').click(e => e.stopPropagation()); // Menu opener $('.menu-opener').click(function(e){ e.preventDefault(); const isOpened = $('body').hasClass('nav-opened'); $('.menu-opener').toggleClass('active'); $('.header, body').toggleClass('nav-opened'); $('.mobile-top-nav').toggleClass('opened'); if (!isOpened) { $('body, .header').css('padding-right', getScrollWidth()); } else{ $('body, .header').css('padding-right', 0); } }); // Wow new WOW().init({ offset: 300 }); // Scroll to anchor $(document).on('click', 'a[href^="#"]', function (event) { event.preventDefault(); if ($.attr(this, 'href') === '#') { return false; } let topNavHeight = 110; if ($(window).width() < 768) { topNavHeight = 60; } if ($(window).width() < 576) { topNavHeight = 54; } $('html, body').animate({ scrollTop: $($.attr(this, 'href')).offset().top - topNavHeight }, 500); }); // Sticky Header function stickyHeader(){ let header = document.querySelector('.header'); if (!!header) { window.scrollY > 0 ? header.classList.add('sticky') : header.classList.remove('sticky'); }; } window.addEventListener('scroll', stickyHeader); setTimeout(stickyHeader, 100); // Modals $('.modal').css('display','block'); $('.modal-dialog').click(e => e.stopPropagation()); $('.modal').click(function(e){ hideModal( $(this) ); $('.video-modal .modal-video').html(''); }); $('.modal-close, .js-modal-close').click(function(e){ e.preventDefault(); hideModal( $(this).closest('.modal') ); $('.video-modal .modal-video').html(''); }); $('[data-modal]').click(function(e){ e.preventDefault(); e.stopPropagation(); hideModal('.modal'); if ($(this).data('modal-tab') != undefined) { goToTab($(this).data('modal-tab')); } showModal( $(this).data('modal') ); }); $('[data-video-modal]').click(function(e) { e.preventDefault(); e.stopPropagation(); let videoId = $(this).data('video-modal'); let videoType = $(this).data('video-type'); if (videoType == 'youtube') { $('#modal-video-iframe').removeClass('vimeo youtube mp4').addClass('youtube').append('
    '); createVideo(videoId, videoId); } else if (videoType == 'vimeo') { $('#modal-video-iframe').removeClass('vimeo youtube mp4').addClass('vimeo').html('