JSFiddle - React, Tailwind, and code Playground
HTML
<div id="dvExpProvHolder" class="hidOverflow innerDivCenter">
<ul class="uSPStyle" id="uSPStyle">
<li class="setRelative"> <a class="tfLink clickMe current" title="Care" data-toggle=".tfLink1" id="" href="javascript:void(0);"><img src="theImages/imgMenu.png" id="imgFirstM" class="imgExpCol" />Care</a>
<ul class="uSPStyle uSPInner" style="width: 80%;">
<li><a class="tfLink clickMe" title="This is sub" data-toggle=".tf1SLink1" href="javascript:void(0);">This is sub</a>
</li>
</ul>
</li>
<li> <a class="tfLink clickMe" title="Breast Cancer" data-toggle=".tfLink2" href="javascript:void(0);"><img src="theImages/imgMenu.png" id="imgFirstM" class="imgExpCol" />BC</a>
<ul class="uSPStyle uSPInner" style="width: 80%;">
<li><a class="tfLink clickMe" title="OUR" data-toggle=".tf1SLink2" href="javascript:void(0);">OUR LINK</a>
</li>
</ul>
</li>
<li> <a class="tfLink clickMe" title="About" data-toggle=".tfLink3" href="javascript:void(0);">About</a>
</li>
<li> <a class="tfLink clickMe" title="Anxiety" data-toggle=".tfLink4" href="javascript:void(0);">Anxiety</a>
</li>
<li> <a class="tfLink clickMe" title="Services" data-toggle=".tfLink5" href="javascript:void(0);">Services</a>
</li>
</ul>
</div>
<div class="tfLink1 dispArtBody">
<tfText01>This is for first link</tfText01>
</div>
<div class="tf1SLink1 dispArtBody hideContent">
<tf1SText01>This is for first link sublink 1</tf1SText01>
</div>
<div class="tfLink2 dispArtBody hideContent">
<tfText02>This is for second link</tfText02>
</div>
<div class="tf1SLink2 dispArtBody hideContent">
<tf1SText02>This is for second link sublink 1</tf1SText02>
</div>
<div class="tfLink3 dispArtBody hideContent">
<tfText03>This is for third link</tfText03>
</div>
<div class=" tfLink4 dispArtBody hideContent">
<tfText04>This...
CSS
* {
padding: 0;
margin: 0;
outline: 0;
/*text-decoration: none;*/
border: 0;
}
body {
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
font-family:'Verdana', 'Tahoma', 'Arial';
font-size: small;
font-weight: normal;
color: #333;
text-rendering: optimizeLegibility;
text-decoration: none;
}
html {
background: #FFF no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
font-family:'Verdana', 'Tahoma', 'Arial';
font-size: small;
font-weight: normal;
color: #333;
text-decoration: none;
}
img {
border: 0;
border-style: none;
}
.imgExpCol {
width: 13px;
height: 13px;
position: absolute;
left: 1%;
top: 2%;
z-index: 1000;
}
.brClear {
clear: both;
}
.brClearLeft {
clear: left;
}
.hideContent {
display: none;
}
.innerDivCenter {
margin: 0 auto;
}
ul.uSPStyle {
list-style-type: none;
width: 95%;
margin: 0px;
padding: 0px;
margin: 0 auto;
}
ul.uSPStyle li {
display: block;
margin-bottom: 1px;
background: #FFF;
text-transform: uppercase;
border-bottom: 1px solid #D5D5D5;
}
ul.uSPStyle li a.current, ul.uSPStyle li a#current, ul.uSPStyle li a:hover {
border-left: 4px solid #E55302;
border-right: 4px solid #E55302;
margin-left: -4px;
margin-right: -4px;
color: #e67e22;
box-sizing: border-box;
background: #FFEEE5;
}
ul.uSPStyle li a {
padding: 10px 20px;
line-height: 20px;
text-decoration: none;
display: block;
position: relative;
color: #175FA0;
margin-left: 0px;
margin-right: 0px;
transition: color 300ms linear;
-o-transition: color 300ms linear;
-ms-transition: color 300ms linear;
-moz-transition: color 300ms linear;
-webkit-transition: color 300ms...
JavaScript
$(function () {
$('.myButton').click(function () {
var vStr = "1.1";
var vULSize = $("#uSPStyle li:not(li li)").size();
var vULSubSize;
if (vStr.indexOf('.') !== -1) {
var vSplit = vStr.split(".");
var vFirst = vSplit[0];
var vSecond = vSplit[1];
console.log(vFirst);
console.log(vSecond);
console.log(vULSize);
if (vFirst <= vULSize) {
$("#uSPStyle li a").removeClass("current");
vULSubSize = $("#uSPStyle > li:eq(" + (vFirst-1) + ") a").addClass("current").size();
//vULSubSize = ""; //get the size of the sub UL inside the above LI
if (vSecond <= vULSubSize) { //if the number is less than or equal to the size of the sub UL
$("#uSPStyle > li:eq(" + (vFirst-1) + ")").find("ul").slideToggle(); //expand the sub UL inside the LI
$("#uSPStyle > li:eq(" + (vFirst-1) + ")").find("ul li:eq(" + vSecond + ")").addClass("current"); //add the 'current class to the sub UL LI
$('.dispArtBody').addClass('hideContent'); //hide all content
var element = $("#uSPStyle li:eq(" + vFirst + ")").find("ul li:eq(" + vSecond + ")").attr("data-toggle"); //get the class of the LI which corresponds to the body class
$(element).removeClass('hideContent'); //show that content which corresponds to the element
}
//$("#uSPStyle li:eq(" + vFirst + ")").find("a").each(function() {
// console.log(this.text);
//});
}
} else {
//{need help}remove 'current' class from the existing parent LI
$("#uSPStyle li:eq(" + vFirst + ")").addClass("current"); //{need help}add the 'current' class to the parent LI
$('.dispArtBody').addClass('hideContent'); //{need help}hide all content
...