Jquery Tabs content rotation effect implementation code a few lines

  • 2020-03-30 01:43:57
  • OfStack


<!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>Jquery the Tabs Content rotation effect implementation code , A few lines with </title>  
<script language="javascript" type="text/javascript" src="/Scripts/jquery-1.4.4.min.js"></script>  
  <style type="text/css">  
        * { margin:0; padding:0;}  
        body { font:12px Verdana, Geneva, sans-serif; color:#404040;}     
        .tabs { margin:10px 0 0 20px; width:360px; position:relative; overflow:hidden; height:1%; height:160px;}  
        .tabs span { z-index:2; font-size:12px; border:1px solid #d5d5d5; width:95px; height:25px; line-height:25px; text-align:center; float:left; margin-right:5px; cursor:pointer;}  
        span.active { background-position:0 -25px; background-color:#d5d5d5;}  
        #tab-01, #tab-02, #tab-03 { position:absolute; top:26px; left:0; width:338px; padding:10px; height:93px; border:1px solid #d5d5d5; z-index:1;}  
        #tab-02, #tab-03 { display:none;}  
    </style>  
    <script type="text/javascript">  
        $(document).ready(function () {  
            $('.tabs span').mouseover(function () {  
              //Hidden div
              $('.tabs div').hide();
              //Look up the. Tabs span peer element next to the peer element div
              $(this).siblings('span').removeClass('active').end().addClass('active').next('div').show();  
            });  
        });  
    </script>  
</head>  

<body>  
    <div class="tabs">  
        <!--  Default first tab Is the active state  -->  
        <span class="active"> Hot news </span>  
        <div id="tab-01">news</div>  
        <span> Entertainment news </span>  
        <div id="tab-02">enteriment</div>  
        <span> Employment situation </span>  
        <div id="tab-03">jobs</div>  
    </div>  
</body>  
</html>  

Related articles: