I now have a sidebar which opens with a button.
我现在有一个侧边栏,用一个按钮打开。
html:
HTML:
<div class="ui left sidebar"><a class="item">Home</a></div>
<div class="pusher"> </div>
javascript:
JavaScript的:
$('.left.sidebar')
.sidebar('setting', {
dimPage : false,
transition : 'push',
mobileTransition : 'push'})
.sidebar('attach events', '#show-menu');
How can I prevent the sidebar to close when the user clicks somewhere on the page?
当用户点击页面上的某个位置时,如何阻止侧边栏关闭?
Thanks!
谢谢!
1 个解决方案
#1
2
found a fiddle which helped me figuring this one out.
发现了一个小提琴,帮助我搞清楚这个。
http://jsfiddle.net/8f11gjez/1/
http://jsfiddle.net/8f11gjez/1/
It seems that if you add the styles
看来如果你添加样式
<div class="ui left sidebar overlay visible"><a class="item">Home</a></div>
<div class="pusher"> </div>
the only problem is the overlay on the pusher but I'll fix that with a media query for the device and add padding to the pusher style.
唯一的问题是推送器上的覆盖,但我会用设备的媒体查询解决这个问题,并为推送器样式添加填充。
#1
2
found a fiddle which helped me figuring this one out.
发现了一个小提琴,帮助我搞清楚这个。
http://jsfiddle.net/8f11gjez/1/
http://jsfiddle.net/8f11gjez/1/
It seems that if you add the styles
看来如果你添加样式
<div class="ui left sidebar overlay visible"><a class="item">Home</a></div>
<div class="pusher"> </div>
the only problem is the overlay on the pusher but I'll fix that with a media query for the device and add padding to the pusher style.
唯一的问题是推送器上的覆盖,但我会用设备的媒体查询解决这个问题,并为推送器样式添加填充。