{"version":3,"file":"js/resources_src_js_share_components__lightbox_js.min.js","mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,iDAAiD;AAC1F;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,iDAAiD;AAC9F;AACA;AACA,SAAS;AACT;AACA;AACA,6CAA6C,iDAAiD;AAC9F;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,iDAAiD;AAC3F;AACA;AACA,SAAS;AACT;AACA,CAAC","sources":["webpack://laravel/./resources/src/js/share/components/_lightbox.js"],"sourcesContent":["$(function () {\r\n\r\n const winW = $(window).width();\r\n\r\n //lightbox-------------------------------------------\r\n let _lb, _img, _txt, _last_el;\r\n var lightbox = $('.lightbox');\r\n closeFn(lightbox);\r\n $(document).on('click', '.lb_btn', function () {\r\n _lb = $(this).data('lb');\r\n _img = $(this).data('img');\r\n _txt = $(this).data('txt');\r\n _last_el = $(this);\r\n if (_img || _txt) {\r\n $('.lb_show_img').attr('src', _img);\r\n $('.lb_show_caption').text(_txt);\r\n }\r\n TweenLite.to($('#' + _lb), .4, { opacity: 1, display: 'flex', ease: Circ.easeOut });\r\n setTimeout(function () {\r\n lb_acc($('#' + _lb), _last_el);\r\n }, 500);\r\n });\r\n\r\n\r\n // tab 點選\r\n $(document).on('keypress', '.lb_btn', function (e) {\r\n if (e.which == 13) {\r\n $(this).click();\r\n }\r\n });\r\n\r\n\r\n function closeFn(lightbox) {\r\n var btnClose = lightbox.find('.btn_close_link');\r\n btnClose.click(function (e) {\r\n {\r\n TweenLite.to(lightbox, .2, { opacity: 0, display: 'none', ease: Circ.easeOut });\r\n _last_el.focus();\r\n }\r\n });\r\n lightbox.click(function (e) {\r\n if ($(e.target).is(lightbox)) {\r\n TweenLite.to(lightbox, .2, { opacity: 0, display: 'none', ease: Circ.easeOut });\r\n _last_el.focus();\r\n }\r\n });\r\n\r\n }\r\n\r\n function lb_acc(modal, _last_el) {\r\n\r\n var _this_focus = modal.find('.first_focus');\r\n _this_focus.focus();\r\n\r\n var focusableElementsString = 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex=\"0\"]';\r\n var focusableElements = modal.find(focusableElementsString);\r\n\r\n focusableElements = Array.prototype.slice.call(focusableElements);\r\n\r\n var firstTabStop = focusableElements[0];\r\n var lastTabStop = focusableElements[focusableElements.length - 1];\r\n\r\n modal.on('keydown', function (e) {\r\n\r\n // SHIFT + TAB\r\n if (e.keyCode === 9) {\r\n if (e.shiftKey) {\r\n if (document.activeElement === firstTabStop) {\r\n e.preventDefault();\r\n $(lastTabStop).focus();\r\n }\r\n\r\n // TAB\r\n } else {\r\n if (document.activeElement === lastTabStop) {\r\n e.preventDefault();\r\n $(firstTabStop).focus();\r\n }\r\n }\r\n }\r\n\r\n // ESCAPE\r\n if (e.keyCode === 27) {\r\n TweenLite.to(modal, .2, { opacity: 0, display: 'none', ease: Circ.easeOut });\r\n _last_el.focus();\r\n }\r\n });\r\n }\r\n});"],"names":[],"sourceRoot":""}