2013-06-01 79 views

回答

6

例如它採用自舉的響應類和兩個jQuery的的onclick事件:http://bootply.com/62828

HTML

<div class="container"> 
<div class="row"> 
    <div class="span9" id="content" style="background-color:blue;"> 
<div class="navbar visible-phone"> 
<div class="container"> 
     <a class="btn btn-navbar" id="showsidebar"> 
     <span class="icon-bar"></span> 
     <span class="icon-bar"></span> 
     <span class="icon-bar"></span> 
     </a> 
</div> 
</div>  
     <p>Main column</p> 
     <p>Content...</p> 
    </div> 
    <div class="span3 hidden-phone" id="sidebar" style="background-color:darkgreen;"> 

<div class="navbar visible-phone"> 
<div class="container"> 
     <a class="btn btn-navbar" id="showcontent"> 
     <span class="icon-bar"></span> 
     <span class="icon-bar"></span> 
     <span class="icon-bar"></span> 
     </a> 
</div> 
</div>  
     Sidebar 
     </div> 
</div> 
</div> 

的JavaScript

$('#showsidebar').click(function(){ 
    $('#sidebar').removeClass('hidden-phone'); 
    $('#content').addClass('hidden-phone'); 

    } 
); 
$('#showcontent').click(function(){ 
    $('#sidebar').addClass('hidden-phone'); 
    $('#content').removeClass('hidden-phone'); 

    } 
); 
+0

正是我一直在尋找!我非常感謝你的幫助,現在我一直在努力完成這個任務。謝謝! – sarytash

相關問題