UNPKG

moschino-ccss16

Version:

Moschino's Capsule Collection Spring Summer 2016 package

79 lines (62 loc) 2.37 kB
var TeaserView = { $el : null, bodyClass : null, ctaGoHeight : null, fastregOptions : { templateId : TEMPLATEINFO.templateId, siteCode : 'MOSCHINO_'+TEMPLATEINFO.iso, enableSMSSender : false, enableEmailSender : false, onBeforeSubmit : function() { console.log('asd'); }, onSuccessSubmit : function() { } }, initialize : function() { console.log('asd'); this.$el = $('body'); this.bodyClass = this.$el.attr('class'); this.resizeCover(); $('.fastreg').fastreg( this.fastregOptions ); $(window).on('resize.cover', $.proxy( this.resizeCover, this ) ); // BIND ALL PAGE EVENT this.bindEvents(); }, resizeCover : function() { this.ctaGoHeight = this.$el.find('.cta-go').height(); this.$el.find('.cover').addClass('show').css('height', GetClientWindowSize('height') - this.ctaGoHeight ); if( this.$el.find('.cover').hasClass('video') ) { var _coverVideoProportion = 16/9, _coverH = this.$el.find('.cover').height(), _coverW = this.$el.find('.cover').width(), _maxVideoSize = _coverW < _coverH ? _coverW : _coverH, _videoH, _videoW, _videoWFinal = _maxVideoSize*_coverVideoProportion, _videoHFinal = _maxVideoSize/_coverVideoProportion; if (_coverW > _coverH) { _videoH = _maxVideoSize; _videoW = _videoWFinal > _coverW ? _coverW : _videoWFinal; } else { _videoW = _maxVideoSize; _videoH = _videoHFinal > _coverW ? _coverH : _videoHFinal; } this.$el.find('.cover iframe').css({'width': _videoW, 'height': _videoH, 'margin-left': -_videoW/2, 'margin-top': -_videoH/2 }); } }, backToTop : function() { _gaq.push(['_trackEvent', 'CustomTemplateEvents', 'MOSCHINO_CC_SS16', 'teaser_pageToTop' ]); $('html,body').animate({scrollTop:0}, 1000, 'easeInOutExpo'); }, goToFastreg : function(event) { _gaq.push(['_trackEvent', 'CustomTemplateEvents', 'MOSCHINO_CC_SS16', 'teaser_pageToFastreg' ]); var _scrollDestination = $(event.currentTarget).data('destination'), _scrollDestinationTop = $(_scrollDestination).offset().top; $('html,body').animate({scrollTop:_scrollDestinationTop}, 1000, 'easeInOutExpo'); }, bindEvents : function() { this.$el.find('.cta-go a').on('click', this.goToFastreg ); this.$el.find('.back-top a').on('click', this.backToTop ); } };