0
我问this question有关根据屏幕大小更改引导弹窗的位置。是否可以根据屏幕宽度更改Bootstrap弹出窗口的操作?
答案很好 - 但是我现在也想改变popovers的动作(所以它是点击手机)以及位置,并且难以重新分解代码。这是我有:
$(document).ready(function(){
$('#my_list li').popover({
placement: wheretoplace
});
});
function wheretoplace(){
var width = window.innerWidth;
if (width<500) return 'below';
return 'left';
}
我将如何修改wheretoplace
函数返回两件事情:使用trigger
值沿着placement
价值?我已经有了jsFiddle中的现有内容。
编辑 - 我已经修改了我上面的jsFiddle以显示完整的解决方案,在@James的答案下面添加了一个click
事件。
是的 - 这要走很长的路要走,谢谢。我已经使用这个代码的版本[这里](http://jsfiddle.net/cherryflavourpez/Dgtvq/);任何想法如何使用Bootstrap获得'点击'功能?我现在只是传递'悬停',因为我无法使用焦点或手动工作。 [引导页面](http://twitter.github.com/bootstrap/javascript.html#popovers)显示可能的值。 – CherryFlavourPez 2012-02-23 16:34:35