diff --git a/website/assets/images/parallax-cloud-city/cloud-city-static-7050x600@2x.png b/website/assets/images/parallax-cloud-city/cloud-city-static-7050x600@2x.png new file mode 100644 index 0000000000..200c1afa2e Binary files /dev/null and b/website/assets/images/parallax-cloud-city/cloud-city-static-7050x600@2x.png differ diff --git a/website/assets/js/components/parallax-city.component.js b/website/assets/js/components/parallax-city.component.js index f023d03fff..11250c8eeb 100644 --- a/website/assets/js/components/parallax-city.component.js +++ b/website/assets/js/components/parallax-city.component.js @@ -54,26 +54,26 @@ parasails.registerComponent('parallaxCity', { }, mounted: async function(){ - if(!bowser.isMobile){ - // Store a reference to the parent container, we'll use this to determine the elements position relative to the user's viewport. - this.parallaxCityElement = $('div[purpose="parallax-city-container"]')[0]; - // Build an array of parallax layers, and set the initial bottom position of each layer to be negative the layer's scroll amount. - for(let layer of $('div.parallax-layer')) { - let scrollAmount = Number($(layer).attr('scroll-amount')); - $(layer).css('bottom', `-${scrollAmount}px`); - this.parallaxLayers.push({element: layer, scrollAmount}); - } - // Determine the parallax image's position on the page/user's viewport. - this.getElementPositions(); - // If the bottom of the element is within the user's viewport, update the positions of the layers. - if(this.parallaxCityElement.getBoundingClientRect().bottom > this.parallaxCityElement.offsetTop) { - this.scrollParallaxLayers(); - } - // Add a scroll event listener - $(window).scroll(this.scrollParallaxLayers); - // Add a resize event listener. - $(window).resize(this.getElementPositions); - } + // if(!bowser.isMobile){ + // // Store a reference to the parent container, we'll use this to determine the elements position relative to the user's viewport. + // this.parallaxCityElement = $('div[purpose="parallax-city-container"]')[0]; + // // Build an array of parallax layers, and set the initial bottom position of each layer to be negative the layer's scroll amount. + // for(let layer of $('div.parallax-layer')) { + // let scrollAmount = Number($(layer).attr('scroll-amount')); + // $(layer).css('bottom', `-${scrollAmount}px`); + // this.parallaxLayers.push({element: layer, scrollAmount}); + // } + // // Determine the parallax image's position on the page/user's viewport. + // this.getElementPositions(); + // // If the bottom of the element is within the user's viewport, update the positions of the layers. + // if(this.parallaxCityElement.getBoundingClientRect().bottom > this.parallaxCityElement.offsetTop) { + // this.scrollParallaxLayers(); + // } + // // Add a scroll event listener + // $(window).scroll(this.scrollParallaxLayers); + // // Add a resize event listener. + // $(window).resize(this.getElementPositions); + // } }, beforeDestroy: function() { @@ -83,25 +83,25 @@ parasails.registerComponent('parallaxCity', { // ║║║║ ║ ║╣ ╠╦╝╠═╣║ ║ ║║ ║║║║╚═╗ // ╩╝╚╝ ╩ ╚═╝╩╚═╩ ╩╚═╝ ╩ ╩╚═╝╝╚╝╚═╝ methods: { - getElementPositions: function() { - this.elementHeight = this.parallaxCityElement.clientHeight; - this.distanceFromTopOfPage = this.parallaxCityElement.offsetTop; - this.distanceFromBottomOfPage = document.body.scrollHeight - this.distanceFromTopOfPage - (this.elementHeight * .5); - this.elementBottomPosition = this.elementHeight + this.distanceFromTopOfPage; - }, - scrollParallaxLayers: function() { - // Calculate how much of the parallax image is visible. - let visibleHeight = (window.scrollY + window.innerHeight) - Math.max(this.distanceFromTopOfPage, window.scrollY); - let percentageScrolled = visibleHeight / (this.distanceFromBottomOfPage + (this.elementHeight / 2 )); - // When the element has been scrolled down 25%, iterate through the layers and update their positions. - if(percentageScrolled > .25 ){ - let adjustedPercentage = (percentageScrolled - .25) * 4/3; - for(let layer of this.parallaxLayers) { - let movement = Math.min(adjustedPercentage * layer.scrollAmount, layer.scrollAmount); - // Update the position of each layer. - $(layer.element).css('transform', 'translate3D(0, -' + movement + 'px, 0)'); - } - } - }, + // getElementPositions: function() { + // this.elementHeight = this.parallaxCityElement.clientHeight; + // this.distanceFromTopOfPage = this.parallaxCityElement.offsetTop; + // this.distanceFromBottomOfPage = document.body.scrollHeight - this.distanceFromTopOfPage - (this.elementHeight * .5); + // this.elementBottomPosition = this.elementHeight + this.distanceFromTopOfPage; + // }, + // scrollParallaxLayers: function() { + // // Calculate how much of the parallax image is visible. + // let visibleHeight = (window.scrollY + window.innerHeight) - Math.max(this.distanceFromTopOfPage, window.scrollY); + // let percentageScrolled = visibleHeight / (this.distanceFromBottomOfPage + (this.elementHeight / 2 )); + // // When the element has been scrolled down 25%, iterate through the layers and update their positions. + // if(percentageScrolled > .25 ){ + // let adjustedPercentage = (percentageScrolled - .25) * 4/3; + // for(let layer of this.parallaxLayers) { + // let movement = Math.min(adjustedPercentage * layer.scrollAmount, layer.scrollAmount); + // // Update the position of each layer. + // $(layer.element).css('transform', 'translate3D(0, -' + movement + 'px, 0)'); + // } + // } + // }, } }); diff --git a/website/assets/styles/components/parallax-city.component.less b/website/assets/styles/components/parallax-city.component.less index 8becc971ca..ed8f0444b4 100644 --- a/website/assets/styles/components/parallax-city.component.less +++ b/website/assets/styles/components/parallax-city.component.less @@ -15,65 +15,69 @@ flex-direction: column; justify-content: flex-end; [purpose='parallax-city-container'] { + background-image: url('/images/parallax-cloud-city/cloud-city-static-7050x600@2x.png'); + background-size: cover; + background-position: center bottom; + background-repeat: no-repeat; height: 600px; position: relative; - .parallax-layer { - position: absolute; - right: 0; - bottom: -1px; - width: 100%; - height: 100%; - will-change: transform; - background-size: auto 100%; - } - [purpose='foreground-cloud-1'] { - background-image: url('/images/parallax-cloud-city/1-cloud-7050x600@2x.png'); - background-position: center bottom; - background-repeat: no-repeat; - z-index: 100; - } - [purpose='foreground-cloud-2'] { - background-image: url('/images/parallax-cloud-city/2-cloud-7050x600@2x.png'); - background-position: center bottom; - background-repeat: no-repeat; - z-index: 99; - } - [purpose='large-island'] { - background-image: url('/images/parallax-cloud-city/4-island-7050x600@2x.png'); - background-position: center bottom; - background-repeat: no-repeat; - z-index: 97; - } - [purpose='background-cloud-1'] { - background-image: url('/images/parallax-cloud-city/5-cloud-7050x600@2x.png'); - background-position: center bottom; - background-repeat: no-repeat; - z-index: 96; - } - [purpose='small-island-1'] { - background-image: url('/images/parallax-cloud-city/6-island-7050x600@2x.png'); - background-position: center bottom; - background-repeat: no-repeat; - z-index: 95; - } - [purpose='small-island-2'] { - background-image: url('/images/parallax-cloud-city/7-island-7050x600@2x.png'); - background-position: center bottom; - background-repeat: no-repeat; - z-index: 95; - } - [purpose='background-cloud-2'] { - background-image: url('/images/parallax-cloud-city/8-cloud-7050x600@2x.png'); - background-position: center bottom; - background-repeat: no-repeat; - z-index: 1; - } - [purpose='background-cloud-3'] { - background-image: url('/images/parallax-cloud-city/9-cloud-7050x600@2x.png'); - background-position: center bottom; - background-repeat: no-repeat; - z-index: 1; - } + // .parallax-layer { + // position: absolute; + // right: 0; + // bottom: -1px; + // width: 100%; + // height: 100%; + // will-change: transform; + // background-size: auto 100%; + // } + // [purpose='foreground-cloud-1'] { + // background-image: url('/images/parallax-cloud-city/1-cloud-7050x600@2x.png'); + // background-position: center bottom; + // background-repeat: no-repeat; + // z-index: 100; + // } + // [purpose='foreground-cloud-2'] { + // background-image: url('/images/parallax-cloud-city/2-cloud-7050x600@2x.png'); + // background-position: center bottom; + // background-repeat: no-repeat; + // z-index: 99; + // } + // [purpose='large-island'] { + // background-image: url('/images/parallax-cloud-city/4-island-7050x600@2x.png'); + // background-position: center bottom; + // background-repeat: no-repeat; + // z-index: 97; + // } + // [purpose='background-cloud-1'] { + // background-image: url('/images/parallax-cloud-city/5-cloud-7050x600@2x.png'); + // background-position: center bottom; + // background-repeat: no-repeat; + // z-index: 96; + // } + // [purpose='small-island-1'] { + // background-image: url('/images/parallax-cloud-city/6-island-7050x600@2x.png'); + // background-position: center bottom; + // background-repeat: no-repeat; + // z-index: 95; + // } + // [purpose='small-island-2'] { + // background-image: url('/images/parallax-cloud-city/7-island-7050x600@2x.png'); + // background-position: center bottom; + // background-repeat: no-repeat; + // z-index: 95; + // } + // [purpose='background-cloud-2'] { + // background-image: url('/images/parallax-cloud-city/8-cloud-7050x600@2x.png'); + // background-position: center bottom; + // background-repeat: no-repeat; + // z-index: 1; + // } + // [purpose='background-cloud-3'] { + // background-image: url('/images/parallax-cloud-city/9-cloud-7050x600@2x.png'); + // background-position: center bottom; + // background-repeat: no-repeat; + // z-index: 1; + // } } @media (max-width: 1399px) { [purpose='parallax-city-container'] {