From 72252bd44e4a392d7c66372c50a311d0241994d5 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Thu, 2 May 2019 00:21:44 +0200 Subject: [PATCH] highlight subscribed members on ladder hover --- battle.css | 29 +++++++++++++++++++++++++---- widget.html | 18 ++++++++++++++++++ 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/battle.css b/battle.css index 710d151..bed4a6e 100644 --- a/battle.css +++ b/battle.css @@ -2,8 +2,6 @@ body { background: #000D1A; color: #CCE6FF; font: 24px Source Sans Pro, Arial, sans-serif; -} -body { margin-top: 1ex; } @@ -31,10 +29,16 @@ strong { letter-spacing: .05em; text-shadow: 0 2px 4px rgba(0, 0, 0, .8), 0 8px 16px rgba(0, 0, 0, .6); } -h2, a { - color: #CCE6FF; + color: inherit; text-decoration: none; + transition: all .5s; +} +a:hover { + color: #FFF; +} +a:hover img { + border-color: #FFF; } em { color: #A3B8CC; @@ -69,6 +73,23 @@ img { background: #021120; } +li, li img { + transition: all 1s; +} +.select > li { + opacity: .5; +} +.select > li.select { + opacity: 1; +} +.select > .select img { + border-color: #055CB3; +} +.ladders li:hover { + background: #0C2643; + cursor: help; +} + .rank:before { background: url("https://static.starcraft2.com/dist/images/none.c8b435f5900fab1ac7981cc9b56f6f44.png") no-repeat; background-position: -100px 0; diff --git a/widget.html b/widget.html index 19e7fe3..a9d615f 100644 --- a/widget.html +++ b/widget.html @@ -33,6 +33,24 @@ `).join('')} ` + + let i = 0 + document.querySelectorAll('.ladders li').forEach(ladder => { + let laddermembers = clan.ladders[i++].members + let membercont = document.querySelector('.members') + ladder.onmouseover = e => { + membercont.classList.add('select') + laddermembers.forEach(member => { + membercont.children[member].classList.add('select') + }) + } + ladder.onmouseout = e => { + membercont.classList.remove('select') + laddermembers.forEach(member => { + membercont.children[member].classList.remove('select') + }) + } + }) }) .catch(error => console.log(error)) -- 2.30.0