{"version":3,"sources":["../src/js/flip-box.js"],"names":["$","BodFlipBox","flipbox","$window","window","$flipbox","$inner","find","$front","$frontImage","$frontContent","$backContent","backContentPadding","parseInt","css","timer","mousehoverstart","bind","mousehoverleave","touchstart","resize","debounceresize","on","addClass","removeClass","toggleClass","clearTimeout","setTimeout","height","Math","max","isNaN","bodFlipBoxs","each","push","jQuery"],"mappings":";;;;;;AAAA;AACA;;AAEA,CAAC,UAASA,CAAT,EAAY;AAAA,OAEJC,UAFI;AAIP,0BAAYC,OAAZ,EAAqB;AAAA;;AAClB,cAAKC,OAAL,GAAeH,EAAEI,MAAF,CAAf;AACA,cAAKC,QAAL,GAAgBL,EAAEE,OAAF,CAAhB;AACA,cAAKI,MAAL,GAAc,KAAKD,QAAL,CAAcE,IAAd,CAAmB,aAAnB,CAAd;AACA,cAAKC,MAAL,GAAc,KAAKH,QAAL,CAAcE,IAAd,CAAmB,aAAnB,CAAd;AACA,cAAKE,WAAL,GAAmB,KAAKJ,QAAL,CAAcE,IAAd,CAAmB,mBAAnB,CAAnB;AACA,cAAKG,aAAL,GAAqB,KAAKL,QAAL,CAAcE,IAAd,CAAmB,qBAAnB,CAArB;AACA,cAAKI,YAAL,GAAoB,KAAKN,QAAL,CAAcE,IAAd,CAAmB,oBAAnB,CAApB;AACA,cAAKK,kBAAL,GAA0BC,SAAS,KAAKF,YAAL,CAAkBG,GAAlB,CAAsB,aAAtB,CAAT,IAAiD,CAA3E;AACA,cAAKC,KAAL;;AAGA;AACA,cAAKC,eAAL,GAAuB,KAAKA,eAAL,CAAqBC,IAArB,CAA0B,IAA1B,CAAvB;AACA,cAAKC,eAAL,GAAuB,KAAKA,eAAL,CAAqBD,IAArB,CAA0B,IAA1B,CAAvB;AACA,cAAKE,UAAL,GAAkB,KAAKA,UAAL,CAAgBF,IAAhB,CAAqB,IAArB,CAAlB;AACA,cAAKG,MAAL,GAAc,KAAKA,MAAL,CAAYH,IAAZ,CAAiB,IAAjB,CAAd;AACA,cAAKI,cA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AO4B,WAAP,GAAqB,EAArB;AACAhC,QAAE,eAAF,EAAmBiC,IAAnB,CAAwB,YAAW;AAChCD,qBAAYE,IAAZ,CAAiB,IAAIjC,UAAJ,CAAe,IAAf,CAAjB;AACF,OAFD;AAGF,IARD;AAUF,CAzED,EAyEGkC,MAzEH","file":"flip-box.js","sourcesContent":["// Jquery document ready passing in JQuery so not to conflict with other\r\n// libs that use $\r\n\r\n(function($) {\r\n\r\n class BodFlipBox {\r\n\r\n constructor(flipbox) {\r\n this.$window = $(window)\r\n this.$flipbox = $(flipbox);\r\n this.$inner = this.$flipbox.find('.flip-inner');\r\n this.$front = this.$flipbox.find('.flip-front');\r\n this.$frontImage = this.$flipbox.find('.flip-front-image');\r\n this.$frontContent = this.$flipbox.find('.flip-front-content');\r\n this.$backContent = this.$flipbox.find('.flip-back-content');\r\n this.backContentPadding = parseInt(this.$backContent.css('padding-top')) * 2;\r\n this.timer;\r\n\r\n\r\n // bind event callback menthods so they use class version of this \r\n this.mousehoverstart = this.mousehoverstart.bind(this);\r\n this.mousehoverleave = this.mousehoverleave.bind(this);\r\n this.touchstart = this.touchstart.bind(this);\r\n this.resize = this.resize.bind(this);\r\n this.debounceresize = this.debounceresize.bind(this);\r\n\r\n // setup events\r\n this.$flipbox.on('mouseenter', this.mousehoverstart);\r\n this.$flipbox.on('mouseleave', this.mousehoverleave);\r\n this.$flipbox.on('touchstart', this.touchstart);\r\n this.$window.on('resize', this.debounceresize);\r\n\r\n this.resize();\r\n }\r\n\r\n mousehoverstart() {\r\n this.$inner.addClass('hover');\r\n }\r\n\r\n mousehoverleave() {\r\n this.$inner.removeClass('hover');\r\n }\r\n\r\n touchstart() {\r\n this.$inner.toggleClass('hover');\r\n }\r\n\r\n debounceresize() {\r\n // debounce : don't keep calling resize box method, only call if not resized for 0.25s\r\n clearTimeout(this.timer);\r\n this.timer = setTimeout(this.resize, 250);\r\n }\r\n\r\n resize() {\r\n // we need to set the height of the flip box based on the max \r\n // front and back height\r\n // outerheight() returns height in pixels with padding and border or margin\r\n let height = Math.max(\r\n isNaN(this.$frontContent.height()) ? 0 : this.$frontContent.height(),\r\n isNaN(this.$backContent.height()) ? 0 : this.$backContent.height()\r\n ) + this.backContentPadding;\r\n this.$inner.height(height);\r\n this.$frontImage.height(height);\r\n }\r\n }\r\n\r\n $(function() {\r\n // loop round all the flip boxes on the page creating an instance\r\n // for each one adding to an array\r\n\r\n window.bodFlipBoxs = [];\r\n $('.bod-flip-box').each(function() {\r\n bodFlipBoxs.push(new BodFlipBox(this));\r\n });\r\n });\r\n\r\n})(jQuery);"]}