diff --git a/flippant.js b/flippant.js index 31f8c8b..c52c127 100644 --- a/flippant.js +++ b/flippant.js @@ -60,23 +60,23 @@ function flip(flipper, content, type, class_name, timeout) { } function set_styles(back, front, position) { - back.style.position = position - back.style.top = front.offsetTop + "px" - back.style.left = front.offsetLeft + "px" - back.style['min-height'] = front.offsetHeight + "px" - back.style.width = front.offsetWidth + "px" - back.style["z-index"] = 9999 + back.style.setProperty('position', position) + back.style.setProperty('top', front.offsetTop + "px") + back.style.setProperty('left', front.offsetLeft + "px") + back.style.setProperty('min-height', front.offsetHeight + "px") + back.style.setProperty('width', front.offsetWidth + "px") + back.style.setProperty('z-index', 9999) } function null_styles(back) { - back.style.top = null - back.style.left = null - back.style.height = null - back.style.width = null + back.style.removeProperty('top') + back.style.removeProperty('left') + back.style.removeProperty('height') + back.style.removeProperty('width') } function card_styles(back) { - back.style.height = 'auto' + back.style.setProperty('height', 'auto') } },{}]},{},[1])(1) }); diff --git a/flippant.min.js b/flippant.min.js index de21cf9..5034730 100644 --- a/flippant.min.js +++ b/flippant.min.js @@ -1 +1 @@ -!function(e){if("function"==typeof bootstrap)bootstrap("flippant",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeFlippant=e}else"undefined"!=typeof window?window.flippant=e():global.flippant=e()}(function(){var define,ses,bootstrap,module,exports;return function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0].call(u.exports,function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;sr;r++)i(o[r]);return i}({1:[function(e,t,o){function i(e,t,o,i,f){function p(){n(d,e,l),d.classList.remove("flipped"),d.classList.remove("flipped"),e.classList.remove("flipped"),window.setTimeout(function(){d.classList.remove(i),document.body.removeChild(d)},f)}var l,d,a;return f=f||400,o=o||"card","modal"===o&&(i=i||"flippant-modal-dark",l="fixed",a=r),"card"===o&&(i=i||"flippant-modal-light",l="absolute",a=s),d=document.createElement("div"),document.body.appendChild(d),n(d,e,l),d.innerHTML=t,e.classList.add("flippant"),d.classList.add("flippant-back"),d.classList.add(i),"absolute"==l?a(d):window.setTimeout(function(){a(d)},0),window.setTimeout(function(){d.classList.add("flipper"),d.classList.add("flipped"),e.classList.add("flipped")},0),d.addEventListener("close",p),d.close=p,d}function n(e,t,o){e.style.setProperty("position",o),e.style.setProperty("top",t.offsetTop+"px"),e.style.setProperty("left",t.offsetLeft+"px"),e.style.setProperty("min-height",t.offsetHeight+"px"),e.style.setProperty("width",t.offsetWidth+"px"),e.style.setProperty("z-index",9999)}function r(e){e.style.removeProperty("top"),e.style.removeProperty("left"),e.style.removeProperty("height"),e.style.removeProperty("width")}function s(e){e.style.setProperty("height","auto")}o.flip=i},{}]},{},[1])(1)}); \ No newline at end of file diff --git a/lib/flip.js b/lib/flip.js index 025aaf3..d18bb7c 100644 --- a/lib/flip.js +++ b/lib/flip.js @@ -58,21 +58,21 @@ function flip(flipper, content, type, class_name, timeout) { } function set_styles(back, front, position) { - back.style.position = position - back.style.top = front.offsetTop + "px" - back.style.left = front.offsetLeft + "px" - back.style['min-height'] = front.offsetHeight + "px" - back.style.width = front.offsetWidth + "px" - back.style["z-index"] = 9999 + back.style.setProperty('position', position) + back.style.setProperty('top', front.offsetTop + "px") + back.style.setProperty('left', front.offsetLeft + "px") + back.style.setProperty('min-height', front.offsetHeight + "px") + back.style.setProperty('width', front.offsetWidth + "px") + back.style.setProperty('z-index', 9999) } function null_styles(back) { - back.style.top = null - back.style.left = null - back.style.height = null - back.style.width = null + back.style.removeProperty('top') + back.style.removeProperty('left') + back.style.removeProperty('height') + back.style.removeProperty('width') } function card_styles(back) { - back.style.height = 'auto' + back.style.setProperty('height', 'auto') } \ No newline at end of file