JSFiddle - React, Tailwind, and code Playground
HTML
<div class="collapsebox">
<div class="collapsebox-header bs-lightgrey">
<h3>Content</h3>
<span class="glyphicon-collapse-down"></span>
</div>
<div id="review-contents" class="collapsebox-body paragraph-style auto-paragraph">
Some text<br />Some text<br />Some text<br />Some text<br />Some text<br />Some text
</div>
</div>
CSS
.glyphicon-collapse-down:after {
content: " (down)";
}
.glyphicon-collapse-up:after {
content: " (up)";
}
.bs-lightgrey {
background: lightgrey;
}
JavaScript
//make jQuery reference to $
var $ =jQuery.noConflict();
(function( $ ) {
$(function() {
//Collapse Box functionality
$(".collapsebox-header").click(function () {
$header = $(this);
//getting the next element
$content = $header.next();
//open up the content needed - toggle the slide- if visible, slide up, if not slidedown.
$content.slideToggle(500);
//toggle collapse-up & collapse-down icons
$( this ).find(".glyphicon-collapse-down").toggleClass( "glyphicon-collapse-down, glyphicon-collapse-up" );
});
//add dropdown icon to the dropdown sidebar widgets
$( "<span></span>" ).addClass( "glyphicon glyphicon-collapse-down pull-right" ).appendTo( ".collapsebox-header h3" );
$( "<span></span>" ).addClass( "glyphicon glyphicon-collapse-down pull-right" ).appendTo( ".collapsebox-header h4" );
//Add plus icon to content items
$( "<span></span>" ).addClass( "glyphicon glyphicon-plus pull-left" ).prependTo( "#review-contents p" );
//Add thumbs up & down to pros & cons
$( "<span></span>" ).addClass( "glyphicon glyphicon-thumbs-up pull-left" ).prependTo( ".pros p" );
$( "<span></span>" ).addClass( "glyphicon glyphicon-thumbs-down pull-left" ).prependTo( ".cons p" );
//add camera icon to pictures tabs
//$(".collapsebox-header.bs-lightgrey.pictures").before($("<span></span>").addClass("glyphicon glyphicon-camera pull-left"));
$("<span></span>").addClass("glyphicon glyphicon-camera pull-right").appendTo( ".pictures h3" );
$("<span></span>").addClass("glyphicon glyphicon-camera pull-right").appendTo( ".pictures h4" );
//Wrap side-info lines in <p> tags
$(".auto-paragraph").each(function () {
var lines = $(this).html().split("<br>");
$(this).html('<p class="bs-lightgrey">' + lines.join("</p><p class='bs-lightgrey'>") + '</p>');
});
//Add plus icon to manufacturer types
//$(".manufacturer-types").before($("<span></span>").addClass("glyphicon glyphicon glyphicon-plus pull-left"));
//Create display options in archive pages
//Toggle...