JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>toggleClass Demo</title>
<link href="toggleClass.css" rel="Stylesheet" type="text/css" />
<script type="text/javascript" src="jquery-1.6.1.js"></script>
<script type="text/javascript" src="toggleClass.js"></script>
</head>
<body>
<p id="results">Results show here. Ticket #9641, new bug</p>
<div id="left"></div>
<div id="center"></div>
<div id="right"></div>
<button id="run">Animation</button>
</body>
</html>
CSS
body
{
background: black;
}
#left
{
background: gold;
border: 1px solid #AAA;
width: 80px;
height: 80px;
margin: 0 5px;
float:left
}
#center
{
background: gold;
border: 1px solid #AAA;
width: 180px;
height: 180px;
margin: 0 5px;
float:left
}
#right
{
background: gold;
border: 1px solid #AAA;
width: 80px;
height: 80px;
margin: 0 5px;
float:left
}
.colored
{
background: green;
}
p
{
color: Blue;
font-size: 2.5em;
}
.highlight
{
background:orange;
}
JavaScript
$(document).ready(function () {
$("#run").click(function () {
$("#center").toggleClass("highlight");
$("p").html($("#center").css("background-color"));
});
function AnimateDiv() {
$("#center").slideToggle("slow", AnimateDiv);
}
$("p").click(function () {
$(this).toggleClass("highlight");
});
AnimateDiv();
});