Contact Us

TriOut Hospitality Premium Brand

954.530.4775
1730 Main St., Ste 226
Weston, FL 33326

jQuery(document).ready(function($){ //define store some initial variables var halfWindowH = $(window).height()*0.5, halfWindowW = $(window).width()*0.5, //define a max rotation value (X and Y axises) maxRotationY = 5, maxRotationX = 3, aspectRatio; //detect if hero has been loaded and evaluate its aspect-ratio $('.cd-floating-background').find('img').eq(0).load(function() { aspectRatio = $(this).width()/$(this).height(); if( $('html').hasClass('preserve-3d') ) initBackground(); }).each(function() { //check if image was previously load - if yes, trigger load event if(this.complete) $(this).load(); }); //detect mouse movement $('.cd-background-wrapper').each(function(){ $(this).on('mousemove', function(event){ var wrapperOffsetTop = $(this).offset().top; if( $('html').hasClass('preserve-3d') ) { window.requestAnimationFrame(function(){ moveBackground(event, wrapperOffsetTop); }); } }); }); //on resize - adjust .cd-background-wrapper and .cd-floating-background dimentions and position $(window).on('resize', function(){ if( $('html').hasClass('preserve-3d') ) { window.requestAnimationFrame(function(){ halfWindowH = $(window).height()*0.5, halfWindowW = $(window).width()*0.5; initBackground(); }); } else { $('.cd-background-wrapper').attr('style', ''); $('.cd-floating-background').attr('style', '').removeClass('is-absolute'); } }); function initBackground() { var wrapperHeight = Math.ceil(halfWindowW*2/aspectRatio), proportions = ( maxRotationY > maxRotationX ) ? 1.1/(Math.sin(Math.PI / 2 - maxRotationY*Math.PI/180)) : 1.1/(Math.sin(Math.PI / 2 - maxRotationX*Math.PI/180)), newImageWidth = Math.ceil(halfWindowW*2*proportions), newImageHeight = Math.ceil(newImageWidth/aspectRatio), newLeft = halfWindowW - newImageWidth/2, newTop = (wrapperHeight - newImageHeight)/2; //set an height for the .cd-background-wrapper $('.cd-background-wrapper').css({ 'height' : wrapperHeight, }); //set dimentions and position of the .cd-background-wrapper $('.cd-floating-background').addClass('is-absolute').css({ 'left' : newLeft, 'top' : newTop, 'width' : newImageWidth, }); } function moveBackground(event, topOffset) { var rotateY = ((-event.pageX+halfWindowW)/halfWindowW)*maxRotationY, yPosition = event.pageY - topOffset, rotateX = ((yPosition-halfWindowH)/halfWindowH)*maxRotationX; if( rotateY > maxRotationY) rotateY = maxRotationY; if( rotateY maxRotationX) rotateX = maxRotationX; if( rotateX 5) this.maxRotation = 5; this.scale = 1; this.animating = false; initParallax(this); initParallaxEvents(this); }; function initParallax(element) { element.count = 0; window.requestAnimationFrame(checkImageLoaded.bind(element)); for(var i = 0; i = this.imgs.length) { initScale(this); if(this.loaded) { window.cancelAnimationFrame(this.loaded); this.loaded = false; } } else { this.loaded = window.requestAnimationFrame(checkImageLoaded.bind(this)); } }; function initScale(element) { var maxImgResize = getMaxScale(element); element.scale = maxImgResize/(Math.sin(Math.PI / 2 - element.maxRotation*Math.PI/180)); element.figure.style.transform = 'scale('+element.scale+')'; Util.addClass(element.element, 'parallax-img--loaded'); }; function getMaxScale(element) { var minWidth = 0; var maxWidth = 0; for(var i = 0; i maxWidth || i == 0 ) maxWidth = width; } var scale = Math.ceil(10*maxWidth/minWidth)/10; if(scale this.maxRotation) rotateY = this.maxRotation; if(rotateY this.maxRotation) rotateX = this.maxRotation; if(rotateX 0 && Util.cssSupports('transform', 'translateZ(0px)')) { for( var i = 0; i