Bootstrap popover在iPad safari上不起作用
Bootstrap popover is not working on iPad safari
我做了一个简单的Bootstrap popover,我调用了popover()函数(使用jQuery)。一切似乎都很好,但当我在iPad上测试时,它不起作用。
<a href="#" title="Description"
data-trigger="focus"
data-container="body"
data-toggle="popover"
data-placement="top"
data-content="This is a test for iPad">Click here to see description</a>
这是我的Javascript:
$("[data-toggle=popover]").popover();
https://jsfiddle.net/masiht/et26me1d/13/
有时您需要它来与data-trigger="focus"
一起工作,为了使这些实例与平台无关,您应该遵循以下示例:
<a tabindex="0" role="button" class="btn btn-lg btn-danger"
data-toggle="popover" data-trigger="focus" title="Dismissible popover"
data-content="And here's some amazing content. It's very engaging. Right?">
Dismissible popover
</a>
关键是要确保使用<a>
标记,并且还设置了tabindex="0"
和role
属性。
我花了一段时间才在文档中找到这个。希望它能帮助到别人。
我很难找到解决方案,这是修复的代码,我希望有一天它能为某人工作:
我认为(数据触发器="焦点")是造成问题的部分。通过删除此属性,它也可以在iPad上工作。
<a data-container="body"
data-toggle="popover"
data-placement="top"
data-content="This is a test for iPad" data-original-title="" title="Description">This works</a>
https://jsfiddle.net/masiht/et26me1d/15/
我已经尝试了所有与iOS兼容的功能,这是我发现的唯一一个在iOS浏览器中可靠工作的功能。
HTML:-
<a tabindex="0" class="popupover" role="button" data-toggle="popover" data-placement="bottom" data-trigger="focus" title="popover title" data-content="popover text here">Click Here</a>
JS:-
$('.popupover').popover();
jQuery("body").on("click touchstart", '.popupover', function() {
$(this).popover("show");
$('.popupover').not(this).popover("hide"); // hide other popovers
return false;
});
jQuery("body").on("click touchstart", function() {
$('.popupover').popover("hide"); // hide all popovers when
clicked on body
});
html:
<a href="javascript:void(0)" class="popupover" data-toggle="popover" data-trigger="click" title="Popover" data-content="something here"></a>
JS:
$('.popupover').popover();
jQuery("body").on("click touchstart", '.popupover', function() {
$(this).popover("show");
$('.popupover').not(this).popover("hide"); // hide other popovers
return false;
});
jQuery("body").on("click touchstart", function() {
$('.popupover').popover("hide"); // hide all popovers when clicked on body
});
相关文章:
- window.open(url).print()在Safari中不起作用
- 复制到剪贴板在safari-angularjs中不起作用
- Javascript Cookies在Safari中不起作用
- 带有Safari的Javascript;不起作用——所有其他浏览器都起作用
- 导航到新url时,Javascript在Safari中不起作用
- JS代码使IE9和Safari冻结,在Opera中不起作用
- html视频javascript播放方法在移动Safari中不起作用
- 为什么这个排序功能在 Safari 中不起作用
- $.getJSON 在 Chrome 和 Safari 中不起作用
- window.dispatchEvent 在 Firefox、Safari 或 IE 中不起作用
- 滚动到顶部按钮在 chrome 或 safari 中不起作用
- jQuery .play() 在移动 Safari 上不起作用
- jQuery .focus() 在 Safari(桌面)的搜索字段中不起作用
- HTML5<视频>元素在Firefox、Opera和Safari中不起作用
- 为什么find('input:focus')在safari中不起作用
- OfflineAudioContext.startRendering()基于承诺的函数在safari中不起作用
- ng模式验证在safari中不起作用
- 图像预览在Safari中不起作用
- 脚本在safari中不起作用
- webcomponents.js polyfills 不起作用:Safari 和 Firefox