javascript - Learning jQuery's tabs + CSS Flexbox. Can anyone help get this working? -
i'm new jquery , advanced css. wondering if take @ code , me working. basically, gray box on left supposed fixed , follow page scrolls(that works). essentially, want have tabs in gray scroll bar, , have content of tabs displayed in orange-ish flexbox on right. understand issue stems separation of <ul>
, content divs in html, because that's how jquery reads tabs. being said, can me achieve i'm looking for. code convoluted, advice welcome. want learn, don't hold back!
$(document).ready(function () { $('#menu').tabs(); $('.ui-tabs-active').removeclass('ui-tabs-active ui-state-active'); });
body { margin:0; margin-top:10px; padding:0px; } #wrapper { border:1px solid black; display:flex; margin-left:300px; margin-right:10px; } #scrollbar { background-color:gray; height:300px; width:280px; position:fixed; margin:10px; margin-top:0px; } #box1 { background-color:#ffcc66; height:1000px; flex:1; } .tabs { list-style-type: none; margin:0; padding:0; z-index:10; width:100%; } .contentdiv { width:100%; padding: 0; position: relative; } .tabs { color:black; position:relative; text-decoration:none; } .tabs li:focus { outline:none; color:orange; } .tabs a:hover, .tabs a:focus { color:blue; } .tabs a:focus, .tabs a:active { outline: none; cursor:pointer; color:orange; } .ui-tabs-active { color:orange; overflow:visible; } .contentdiv { width:100%; padding: 0; position: relative; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <body> <div id="scrollbar"> <div id="menu"> <ul class="tabs"> <li><a href="coding">coding</a> </li> <li><a href="photo">photography</a> </li> <li><a href="info">about me</a> </li> </ul> </div> </div> <div id="wrapper"> <div id="box1"> <div id="coding" class="contentdiv"> <div class="fillertext"> <p>this code</p> </div> </div> <div id="photography" class="contentdiv"> <div class="fillertext"> <p>these pictures</p> </div> </div> <div id="info" class="contentdiv"> <div class="fillertext"> <p>this info</p> </div> </div> </div> </div> </body>
i don't know why have added line :
$('.ui-tabs-active').removeclass('ui-tabs-active ui-state-active');
in code don't have classes "ui-tabs-active", "ui-tabs-active", "ui-state-active"
some classes , jquery needs fixed in code :
here fiddle
Comments
Post a Comment