JSFiddle - React, Tailwind, and code Playground
by davehol
CSS
.xm-grouped-table a:hover {
color: rgb(58, 58, 58);
opacity: 0.5;
text-decoration: underline;
}
.rmit-table__wrapper {
overflow-x: auto;
}
.Vocational,
.Undergraduate,
.showAll {
font-family: Arial;
background-color: rgb(255, 255, 255);
color: #333333;
outline: none;
border-bottom: 2px solid #E1E1E1;
display: block;
font-size: 16px;
margin: 0;
margin-bottom: -2px;
white-space: pre-wrap;
line-height: 16px;
padding: 7px 16px 15px 16px;
text-decoration: none !important;
float: left;
position: relative;
}
.Vocational:hover,
.Undergraduate:hover,
.showAll:hover {
border-bottom: 2px solid #E60028;
color: #333333;
}
.filterWrapper {
width: 100%;
border-bottom: 2px solid #E1E1E1;
float: left;
height: 20 px;
margin-top: 32px;
}
.red {
border-bottom: 2px solid #E60028;
color: #333333 !important;
}
.rmitFooter__Wrapper {
padding-bottom: 60px;
}
@media screen and (max-width: 750px) {
.Vocational,
.Undergraduate,
.showAll {
float: none;
background-color: transparent;
border-bottom: 1px solid #e1e1e1;
padding-top: 16px;
}
.red {
color: #000054 !important;
font-weight: bold;
}
.Vocational:hover,
.Undergraduate:hover,
.showAll:hover {
border-bottom: 1px solid #e1e1e1;
}
.filterWrapper {
border: none;
}
}
JavaScript
var prog_list = (function() {
var prog_table = $(".xm-grouped-table");
var filterPos = $(".relatedprogramlist");
var init, setStyle, tabe_style, tbl, div1, div2, div3, rows, filterList, GetQueryStringParams, filterVal;
div1 = $("<div/>");
div2 = $("<div/>");
div3 = $("<div/>");
var filterBy = $('<div/>').append("<a class='Vocational' href='#'>Certificates and diplomas</a><a class='Undergraduate ' href='#'>Degrees</a><a class='showAll' href='#'>Show all</a>").addClass("filterWrapper");
setStyle = function(st) {
table_style = st;
}
$('.responsivegrid').on('click', '.Undergraduate, .Vocational, .showAll', function() {
filterList($(this).attr("class").split(' ')[0], $(this).parent().next(".relatedprogramlist").find("table"));
$(this).parent().find('a.red').removeClass('red')
$(this).addClass('red');
return false;
});
init = function() {
$("body").height(100);
filterVal = GetQueryStringParams("filter");
$.each(prog_table, function(index) {
tbl = $(this);
tbl.find("tr").unwrap();
tbl.wrapInner("<tbody></tbody>");
tbl.attr({
width: "100%",
cellspacing: "1",
border: "1",
cellpadding: "1"
});
tbl.find(".m-program-list-location a").contents().unwrap();
div1.addClass("table rmit-table__" + table_style + " aem-GridColumn aem-GridColumn--default--12");
div2.addClass("rmit-table__wrapper");
div3.addClass("cmp-text");
tbl.wrap(div1).wrap(div2).wrap(div3);
tbl.removeClass("table");
tbl.find(".m-program-list-title .visible-xxs").removeClass("visible-xxs").addClass("hide");
tbl.find("caption").remove();
tbl.find("th").eq(3).hide();
tbl.find("th").eq(4).hide();
tbl.find("tr").each(function(index) {
if (index !== 0) {
$row = $(this);
$row.find("td").eq(4).find("a").eq(1).attr("href", $row.find("td").eq(1).find("a").attr("href")).text("Learn more");
...