"Color Changer"
Bootstrap 3.0.0 Snippet by AdnanKhan123

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <div class="apDiv1"></div> <div class="apDiv12"></div> <div class="apDiv2"> <button class="red" id="btn-1"></button> <button class="blue" id="btn-2"></button> <button class="yellow" id="btn-3"></button> </div> </div> </div>
.apDiv1 { position:absolute; left:9px; top:110px; width:1300px; height:44px; background-color:#666666; z-index:1; } .apDiv12 { position:absolute; left:9px; top:160px; width:600px; height:44px; background-color:#666666; z-index:1; } .apDiv2 { position:absolute; left:9px; top:0px; width:45px; height:104px; background-color:#ccc; z-index:1; } .red { position:relative; float:right; margin-right:10px; margin-top:10px; width:21px; height:19px; background-color:red; z-index:4; } .blue { position:relative; float:right; margin-right:10px; margin-top:10px; width:21px; height:19px; background-color:blue; z-index:4; } .yellow { position:relative; float:right; margin-right:10px; margin-top:10px; width:21px; height:19px; background-color:yellow; z-index:4; }
$(document).ready(function() { $("#btn-1").click(function() { $(".apDiv1, .apDiv12").css({"background-color" :"red"}); }); $("#btn-2").click(function() { $(".apDiv1, .apDiv12").css({"background-color" :"blue"}); }); $("#btn-3").click(function() { $(".apDiv1, .apDiv12").css({"background-color" :"yellow"}); }); });

Related: See More


Questions / Comments: