Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
455 views
in Technique[技术] by (71.8m points)

javascript - 使用侧边栏阻止语义UI溢出内容(Stop Semantic UI from overflowing content with sidebar)

I'm using the Semantic UI sidebar on my page for navigation.(我将页面上的语义UI侧栏用于导航。)

By default, I'd like to have it visible with the option for the user to close it if they like.(默认情况下,我希望它显示为可见,并带有供用户根据需要关闭它的选项。) The problem is that by having the sidebar open by default, my page content gets pushed off screen and is overflowing so that part of the page is cut off.(问题是,默认情况下,通过打开侧边栏,我的页面内容被推到屏幕之外并溢出,因此页面的一部分被截断了。) Not seeing anything in the docs about making the page content conform to the available width rather than get pushed off screen.(在文档中没有看到任何有关使页面内容符合可用宽度而不是被推离屏幕的信息。)

 $('.toggler').on('click', function() { $('.ui.sidebar').sidebar('toggle'); }); 
 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Semantic UI Sidebar test</title> <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.4/semantic.min.css"> </head> <body> <div class="ui left sidebar inverted vertical menu visible pushable"> <a href="#" class="item">Sidebar Link</a> </div> <div class="ui pusher"> <div class="ui menu"> <a class="item toggler"> Toggle </a> <div class="item header"> Semantic UI </div> <div class="menu right"> <a href="#" class="item">Test</a> </div> </div> <div class="ui segment"> <table class="ui celled table"> <thead> <tr><th>Header</th> <th>Header</th> <th>Header</th> </tr></thead> <tbody> <tr> <td> <div class="ui ribbon label">First</div> </td> <td>Cell</td> <td>Cell</td> </tr> <tr> <td>Cell</td> <td>Cell</td> <td>Cell</td> </tr> <tr> <td>Cell</td> <td>Cell</td> <td>Cell</td> </tr> </tbody> <tfoot> <tr><th colspan="3"> <div class="ui right floated pagination menu"> <a class="icon item"> <i class="left chevron icon"></i> </a> <a class="item">1</a> <a class="item">2</a> <a class="item">3</a> <a class="item">4</a> <a class="icon item"> <i class="right chevron icon"></i> </a> </div> </th> </tr></tfoot> </table> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script type='text/javascript' src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.4/semantic.min.js"></script> </body> </html> 

  ask by kmm translate from so


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Take a look at the Examples section for Sidebar docs .(查看补充工具栏文档的“ 示例”部分 。)

You have two choices I think:(我认为您有两种选择:)
  1. Scaling down the content using <div class="ui left sidebar inverted vertical menu visible scale down">(使用<div class="ui left sidebar inverted vertical menu visible scale down">)

  2. Make the sidebar display over the content using overlay css class: <div class="ui left sidebar inverted vertical menu visible overlay">(使用overlay CSS类使边栏显示在内容上: <div class="ui left sidebar inverted vertical menu visible overlay">)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...