大佬教程收集整理的这篇文章主要介绍了twitter-bootstrap – 禁用bootstrap数据属性API?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
$( ‘主体’)OFF( ‘数据的API.’);
我认为在某些情况下,当其他javascripts使用相同的数据属性时,这真的很酷.您只需在特殊区域中禁用bootstrap-API.
例如,在每个a-Tag中禁用API:
<html> <head> <title>Bootstrap - Test - Disable The API</title> <Meta name="viewport" content="width=device-width,initial-scale=1.0"> <link href="css/bootstrap.min.css" rel="stylesheet" media="screen"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="js/bootstrap.min.js"></script> <script> $(document).ready(function() { //This is working: $(document).off('.data-api'); //This is not working: $('a').off('.data-api'); }); </script> </head> <body> <!-- Button to open the modal --> <a id="clickBtn" href="#mymodal" data-toggle="modal">Launch demo modal</a> <!-- Modal --> <div id="mymodal" class="modal hide fade"> This is just a little test </div> </body> </html>
但它没有用.
模态还有一个clickEvent.
谁能告诉我我做错了什么?
$(document).on('click.modal.data-api','[data-toggle="modal"]',function (E) { ... })
当然你不能禁用api
$( ‘主体’)OFF( ‘数据的API.’);或$(‘#clickBtn’).off(‘.data-api’);
因为处理程序附加到文档根目录而不是附加到正文或元素本身.
如果要为特殊元素禁用API(在我的示例中为a-Tag),则必须从off-method定义SELEctor-parameter:
$(document).off('.data-api','a');
看起来bootstrap文档有点令人困惑……
以上是大佬教程为你收集整理的twitter-bootstrap – 禁用bootstrap数据属性API?全部内容,希望文章能够帮你解决twitter-bootstrap – 禁用bootstrap数据属性API?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。