JSFiddle - React, Tailwind, and code Playground
HTML
<ul>
<li>
<h4>Increased drinking caused by cancer fears</h4>
<p>New research shows that every time new research shows a new link to cancer,
people respond by getting so drunk they forget they even read about it in the first place.</p>
</li>
<li>
<h4>Increased drinking caused by cancer fears</h4>
<p>New research shows that every time new research shows a new link to cancer,
people respond by getting so drunk they forget they even read about it in the first place.</p>
</li>
<li>
<strong>An American study from 2002 linking cancer to looking at a photograph of a cartoon badger smoking a pipe</strong>
</li>
</ul>
CSS
body {
background: black
}
ul {
left: 130px;
position: absolute;
top: 50px;
width: 450px;
z-index: 2;
height: 1%;
}
ul li {
margin-bottom: 2px;
position:relative;
}
ul h4,
strong {
background: #ffffff;
cursor: pointer;
color: #323334;
margin: 0;
font-size: 16px;
padding: 4px 36px 4px 17px;
display: block;
font-family: sans-serif;
font-weight: normal;
}
ul h4 {
position:relative;
line-height: 32px;
}
ul h4:focus {
outline: none;
}
ul strong {
line-height: 28px;
}
.faded {
}
h4:hover,
strong:hover,
.faded:hover {
background: #ffffff;
opacity: 1;
}
h4 .icon {
position:absolute;
width:17px;
height:17px;
display:block;
right:12px;
top:12px;
}
h4.ui-state-active .icon {
}
ul p {
background: #ffffff;
margin: 0;
padding:10px;
color: #6b6c6f;
}
JavaScript
var accordion = $("ul").accordion({
collapsible: true,
active: false,
autoHeight: false,
header: "h4",
icons: {
header: "icon",
headerSelected: "icon"
},
changestart: function(event, ui) {
makeCurrent(ui.newHeader);
}
})
accordion
.find("strong")
.click(function(ev) {
makeCurrent($(ev.target));
accordion.accordion( "activate" , false );
});
function makeCurrent($item) {
$item.removeClass("faded").css("opacity", "")
.closest("li").siblings().children("h4,strong").not(".faded").css({opacity: 0.5});
}