if (window.matchMedia('(max-width: 2799px)').matches) {
// do functionality on screens smaller than 2799px
var headerTitleArr = ["Players","Stamina","Home Runs"];
var headerTitleArrLength = 2;
var mainChart = $("#chart1");
var headerIndexCount = 0;
// loop thru each of the tr.table-tr rows tracked by index and change the th text's index with the header text value
$("#chart1 tr.table-tr > th").each(function(thIndex) {
headerIndex = headerIndexCount;
// TO FIX
$(this).text(headerTitleArr[headerIndex]);
console.log(headerTitleArr[headerIndex]);
console.log($(this).text());
headerIndexCount++;
// if headerIndex equals to the length of the array, reset value
if (headerIndex == headerTitleArrLength) {
headerIndexCount = 0; // reset value
// add border after each end of the header title array length
$(this).parent().after('<div class="divider" style="border-bottom: 1px solid #ccc;margin: 25px 0px;"></div>');
}
});
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.