// all socail together function displaySocial(targetParent, targetClick, targetCard) { openSocial(targetParent, targetClick, targetCard); closeSocial(targetParent, targetCard); socialFocus(targetParent, targetCard); $('.socialShare__close a').attr('tabindex', 0); } // open social buttons function openSocial(targetParent, targetClick, targetCard) { $(targetParent).on('click', targetClick, function (e) { e.preventDefault(); // hack for event top nav, hide it if social share is active //$('.events .slick-dots').css('display', 'none') if (isKeyboardUser) { $('.socialShare').css({ 'display': 'none' }); $(this).closest(targetCard).find('.socialShare').css({ 'display': 'block' }).find('a:first').focus(); } else { $('.socialShare').removeClass('socialShare__slide'); $(this).closest(targetCard).find('.socialShare').addClass('socialShare__slide'); } }); } // close social buttons function closeSocial(targetParent, targetCard) { $(targetParent).on('click', '.socialShare__close a, .socialShare__close', function (e) { e.preventDefault(); // hack for event top nav, hide it if social share is active //$('.events .slick-dots').removeAttr('style') if (isKeyboardUser) { $(this).closest(targetCard).find('.socialShare').css({ 'display': 'none' }); $(this).closest(targetCard).find('.socialShare__share').focus(); } else { $(this).closest(targetCard).find('.socialShare').removeClass('socialShare__slide'); } }); } // focus loop on event card function socialFocus(targetParent, targetCard) { $(targetParent).on('focus', '.socialShare__end', function () { $(this).closest(targetCard).find('.socialShare a:first').focus(); }); } // close all social share function closeAllSocial() { $('.socialShare').removeClass('socialShare__slide').removeAttr('style'); // hack for event top nav, show it if social share is close //$('.events .slick-dots').removeAttr('style'); } $(function () { // set social share close button $(document).on('keydown', ".eventCard__share", function (e) { if (e.keyCode == 13) { $(this).find('.eventCard').find('.socialShare__slide .socialShare__icon:first a').focus(); } }); $(document).on('keydown', ".relatedCard__share", function (e) { if (e.keyCode == 13) { $(this).click(); } }); $(document).on('keydown', '.socialShare .socialShare__icon a', function (e) { if (e.keyCode == 9) { if (e.shiftKey) { if ($(this).parent().find('.icon-linkdin-icon').length > 0) { return false; } } else { if ($(this).parent().find('.icon-close-icon').length > 0) { return false; } } } if (e.keyCode == 13) { if ($(this).parent().find('.icon-close-icon').length > 0) { $('.socialShare').removeClass('socialShare__slide').removeAttr('style'); if ($(this).parents('.eventCard').length > 0) { $(this).parents('.eventCard').find('.icon-share-icon').parent().focus(); } else if ($(this).parents('.slick-slide').length > 0) { $(this).parents('.slick-slide').find('.icon-share-icon').parent().focus(); } } } }); });