{"version":3,"file":"chunks/363647b9ec55e4.js","mappings":"6xBAEA,IAGqBA,EAAe,WAGlC,SAAAA,K,4FAAcC,CAAA,KAAAD,GACZE,EAAEC,UAAUC,MAAMC,KAAKC,KAAKC,KAAKF,MACnC,C,QA4BC,O,EA5BAL,G,EAAA,EAAAQ,IAAA,OAAAC,MAED,WACEJ,KAAKK,QAAUR,EAAES,QACjBN,KAAKO,mBAAqBV,EAZR,sBAclBG,KAAKK,QAAQG,GAAG,gBAAiBR,KAAKS,mBAAmBP,KAAKF,OAC9DA,KAAKK,QAAQK,QAAQ,SACvB,GAAC,CAAAP,IAAA,qBAAAC,MAED,WACE,IAAMO,EAAuC,EAAxBX,KAAKK,QAAQO,SAC5BC,EAAoBb,KAAKK,QAAQS,YACjCC,EAAwBF,EAAoBF,EAElDd,EAAAA,KAAOG,KAAKO,oBAAoB,WAC9B,IAAMS,EAAWnB,EAAEG,MACbiB,EAAgBD,EAASE,cACzBC,EAAqBH,EAASI,SAASC,IACdF,EAAqBF,GAGzBJ,GACzBM,GAAsBJ,GAEtBC,EAASM,SAhCoB,6BAkCjC,GACF,M,oEAAC3B,CAAA,CAjCiC,E","sources":["webpack:///./resources/js/components/showroom/fade-up-animation.ts"],"sourcesContent":["import * as $ from \"jquery\";\n\nconst ELEMENT_CLASS = '.fade-up-animation';\nconst IN_VIEW_ANIMATION_CLASS_NAME = 'fade-up-animation--in-view';\n\nexport default class FadeUpAnimation {\n  $window?: JQuery<Window & typeof globalThis>;\n  $animationElements?: JQuery<HTMLElement>;\n  constructor() {\n    $(document).ready(this.init.bind(this));\n  }\n\n  init() {\n    this.$window = $(window);\n    this.$animationElements = $(ELEMENT_CLASS);\n\n    this.$window.on('scroll resize', this.handleScrollResize.bind(this));\n    this.$window.trigger('scroll');\n  }\n\n  handleScrollResize() {\n    const windowHeight = this.$window.height() * 2; // start animation 2x of screen-height\n    const windowTopPosition = this.$window.scrollTop();\n    const windowBottomPosition = (windowTopPosition + windowHeight);\n\n    $.each(this.$animationElements, function() {\n      const $element = $(this);\n      const elementHeight = $element.outerHeight();\n      const elementTopPosition = $element.offset().top;\n      const elementBottomPosition = (elementTopPosition + elementHeight);\n\n      if (\n        elementBottomPosition >= windowTopPosition &&\n        elementTopPosition <= windowBottomPosition\n      ) {\n        $element.addClass(IN_VIEW_ANIMATION_CLASS_NAME);\n      }\n    });\n  }\n}\n"],"names":["FadeUpAnimation","_classCallCheck","$","document","ready","this","init","bind","key","value","$window","window","$animationElements","on","handleScrollResize","trigger","windowHeight","height","windowTopPosition","scrollTop","windowBottomPosition","$element","elementHeight","outerHeight","elementTopPosition","offset","top","addClass"],"sourceRoot":""}