[英]Semantic ui sidebar implementation
Hello how do i implement the sidebar from semantic ui? 您好我如何从语义ui实现侧边栏? I would like to use the first example on the list.
我想使用列表中的第一个示例。
http://semantic-ui.com/modules/sidebar.html#/definition http://semantic-ui.com/modules/sidebar.html#/definition
I tried copy-pasting the whole div section and putting it on my html For the javascript(? not really sure), the 我试着复制粘贴整个div部分并把它放在我的html上对于javascript(?不是很确定),
$('.left.demo.sidebar')
.sidebar('toggle')
;
i tried putting it on button onclick , and function then using href to call but sidebar is not showing.. what am i doing wrong 我试着把它放在按钮onclick上,然后使用href来调用但侧边栏没有显示..我做错了什么
You have to include the jQuery
library in the <head></head>
section of your page: 您必须在页面的
<head></head>
部分中包含jQuery
库:
<script language="javascript" src="http://code.jquery.com/jquery.min.js"></script>
And the semantic.js
file: 和
semantic.js
文件:
<script language="javascript" src="[your path here]/semantic.js"></script>
Which you have to download from: 您必须从以下网址下载:
http://semantic-ui.com/ http://semantic-ui.com/
(It's located inside the folder dist. Copy that file in the desire location and populate src
with the right path) (它位于文件夹dist内。将该文件复制到所需位置并使用正确的路径填充
src
)
BETWEEN <HEAD></HEAD>
: BETWEEN
<HEAD></HEAD>
:
<script language="javascript" src="http://code.jquery.com/jquery.min.js"></script>
<script language="javascript" src="[your path here]/semantic.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.left.demo.sidebar').sidebar('toggle');
});
</script>
When you add jQuery to your project you can trigger your sidebar by adding this code to your .js file: 当您将jQuery添加到项目中时,可以通过将此代码添加到.js文件来触发侧栏:
$('.element.to.trigger.sidebar').on('click', function () {
$('.left.demo.sidebar')
.sidebar('toggle');
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.