From 7c320c7614946cc1b83894b4634101dd3d148fb4 Mon Sep 17 00:00:00 2001 From: j Date: Wed, 9 May 2018 10:48:35 +0100 Subject: [PATCH] adjust aspect ratio of reflection if logo ratio is not 2 --- static/js/home.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/static/js/home.js b/static/js/home.js index 563462b9..980151f9 100644 --- a/static/js/home.js +++ b/static/js/home.js @@ -247,6 +247,8 @@ pandora.ui.home = function() { }) .appendTo(that); + adjustRatio(); + if (pandora.user.level == 'guest') { $signupButton.appendTo(that); $signinButton.appendTo(that); @@ -254,6 +256,28 @@ pandora.ui.home = function() { $preferencesButton.appendTo(that); } + function adjustRatio() { + var width = $logo.width(); + var height = $logo.height(); + if (width == 0 || height == 0) { + setTimeout(adjustRatio, 50); + } + var aspect = width / height; + if (aspect != 2) { + var top = 320 / aspect; + $reflectionImage.css({ + top: top + 'px', + }) + $reflectionGradient.css({ + top: top + 'px', + height: (top + 2) + 'px', + }) + $logo.css({ + bottom: top + 'px', + }) + } + } + that.fadeInScreen = function() { that.appendTo(Ox.$body).animate({opacity: 1}, 500, function() { that.find(':not(#logo)').animate({opacity: 1}, 250, function() {