I'm currently in the process of developing an application that consists of six distinct topics organized within a flexbox structure, complete with a box-shadow effect.
My objective is to dynamically alter the color of the box-shadow through an event handler, ensuring that it matches the color of the button associated with the selected topic by the user. For instance, upon clicking the "Technology" button, the box-shadow should transition from #D1D1D1 to #6699FF).
Despite my efforts of extensively researching on MDN and Treehouse to uncover a solution, I have been unsuccessful thus far.
The jQuery code supplied within this inquiry fails to execute properly; any assistance provided would be greatly appreciated!
This is a summary of what I've managed to compile up until now:
$(“.buttons”).click(function(){
var color = $(this).css(“background-color”);
var box-shadow = “0 5px” + color;
$(this).parent().css("box-shadow”);
});
/* =================================
Page Styles
==================================== */
* {
box-sizing: border-box;
}
body {
font-size: 1.2em;
font-family: 'Varela Round', sans-serif;
color: #fff;
background: #f2f2f2;
padding-left: 5%;
padding-right: 5%;
}
header {
text-align: center;
color: #000;
font-size: 1.2em;
}
.topics {
padding: 10px;
background: #fff;
border-radius: 25px;
margin: 45px auto;
display: flex;
flex-wrap: wrap;
justify-content: space-around;
text-align: center;
box-shadow: 0 2.5px 0 0 #d1d1d1;
}
.technology {
color: #fff;
padding: 15px;
margin: 5px;
background: #6699FF;
border-radius: 3px;
}
.business {
color: #fff;
padding: 15px;
margin: 5px;
background: #32BC67;
border-radius: 3px;
}
.entertainment {
color: #fff;
padding: 15px;
margin: 5px;
background: #9F60FF;
border-radius: 3px;
}
.shopping {
color: #fff;
padding: 15px;
margin: 5px;
background: #F44658;
border-radius: 3px;
}
.sports {
color: #fff;
padding: 15px;
margin: 5px;
background: #FE9900;
border-radius: 3px;
}
.weather {
color: #fff;
padding: 15px;
margin: 5px;
background: #FFC100;
border-radius: 3px;
}
/* =================================
Flexbox
==================================== */
.articles {
display: -webkit-flex;
display: flex;
-webkit-flex-direction: row;
flex-direction: row;
background: #fff;
border-radius: 25px;
flex-wrap: wrap;
justify-content: space-around;
text-align: left;
box-shadow: 0 0 10px #D1D1D1;
}
.article-1 {
display: table-cell;
background-color: #fff;
width: 300px;
height: 200px;
border-radius: 3px;
border-color: #D1D1D1;
border-width: 1px;
padding: 50px;
margin: 25px;
box-shadow: 2px 2px 10px #D1D1D1;
}
.article-2 {
display: table-cell;
background-color: #fff;
width: 300px;
height: 200px;
border-radius: 3px;
border-color: #D1D1D1;
border-width: 1px;
padding: 50px;
margin: 25px;
box-shadow: 2px 2px 10px #D1D1D1;
}
.article-3 {
display: table-cell;
background-color: #fff;
width: 300px;
height: 200px;
border-radius: 3px;
border-color: #D1D1D1;
border-width: 1px;
padding: 50px;
margin: 25px;
box-shadow: 2px 2px 10px #D1D1D1;
}
<!DOCTYPE html>
<html>
<head>
<title>Daily News</title>
<link href='https://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/page.css">
<link rel="stylesheet" href="css/flexbox.css">
</head>
<body>
<header>
</header>
<nav class="topics">
<nav class="technology">Technology</nav>
<nav class="business">Business</nav>
<nav class="entertainment">Entertainment</nav>
<nav class="shopping">Shopping</nav>
<nav class="sports">Sports</nav>
<nav class="weather">Weather</nav>
</nav>
<section class="articles">
<section class=article-1>
</section>
<section class=article-2>
</section>
<section class=article-3>
</section>
</section>
</body>
</html>