bulma-extensions
Version:
Set of extensions for Bulma.io CSS Framework
1 lines • 849 B
JavaScript
var MOUSE_EVENTS=["click","touchstart"];function closest(e,t){var c,n;for(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"].some(function(e){return"function"==typeof document.body[e]&&(c=e,!0)});e;){if((n=e.parentElement)&&n[c](t))return n;e=n}return null}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll('[data-show="quickview"]');[].forEach.call(e,function(e){var t=document.getElementById(e.dataset.target);t&&MOUSE_EVENTS.forEach(function(c){e.addEventListener(c,function(e){e.preventDefault(),t.classList.add("is-active")})})});var t=document.querySelectorAll('[data-dismiss="quickview"]');[].forEach.call(t,function(e){var t=closest(e,".quickview");t&&MOUSE_EVENTS.forEach(function(c){e.addEventListener(c,function(e){t.classList.remove("is-active")})})})});