jquery prototype 兼容
来源:互联网 发布:知名的中文域名案例 编辑:程序博客网 时间:2024/05/18 01:09
我对重要的部分做下翻译,希望对大家有所帮助。特别是magneto的js库使用prototype,很多人想用jquery,那么这个兼容就很有 用了。
jquery prototype 兼容分两种情况,我们就让prototype可以正常使用,在使用jquery的时候做下代码的兼容处理。
第一种:先加载prototype,后加载jquery
---------------------------------------------------
<html>
<head>
<script src="/prototype.js"></script>
<script src="/jquery.js"></script>
<script>
jQuery.noConflict();
// Put all your code in your document ready area
jQuery(document).ready(function($){
// Do jQuery stuff using $
$("div").hide();
});
// Use Prototype with $(…), etc. $('someid').hide(); </script> </head> <body></body> </html> ———————————— 如上所示,红色部分就是对jquery做的一个兼容处理,这样就可以达到 jquery和prototype兼容了。jQuery.noConflict();要放在 最前面,而jquery的代码就要放到 jQuery(document).ready(function($){ ……… }); 内部。
第二种:先加载jquery,后加载prototype
———————————–
<html>
<head>
<script src="/jquery.js"></script>
<script src="/prototype.js"></script>
<script>
// Use jQuery via jQuery(...)
jQuery(document).ready(function(){
jQuery("div").hide();
});
// Use Prototype with $(...), etc.
$('someid').hide();
</script>
</head>
<body></body>
</html>
———————————–
如上所示,不用调用 jQuery.noConflict();,使用 jQuery(document).ready(function(){ …….. });,在这个函数内部使用jQuery代替$。
- jquery prototype 兼容
- jquery prototype 兼容
- magento中jquery prototype 兼容
- jQuery与prototype不兼容
- magento中jquery prototype 兼容
- jQuery 与其它 js(Prototype) 库兼容共存
- Ext,prototype 与 jQuery
- prototype与jquery实例
- jQuery 与 prototype 共存
- prototype.js jquery.js
- Ext Prototype jQuery整合
- jQuery 与 prototype 冲突
- Prototype与JQuery对比
- jQuery.prototype的含义。
- ??jQuery.fn =jQuery.prototype
- [ jQuery ] jQuery.fn和jQuery.prototype区别!
- jquery和prototype冲突解决
- jquery和prototype冲突解决
- 比较好的堆栈详解
- AF_INET和PF_INET的细微不同
- C语言18个经典问题答录
- 马屁股和航天飞机的关系
- 高斯模糊、径向缩放模糊
- jquery prototype 兼容
- windows 查看端口使用情况
- 所谓“软件”和“硬件”
- 线程间通讯
- 买联想电脑建议
- pdf资料
- 连接查询
- C语言中冒号的作用
- 你们有没有泰克TDS1002的说明书啊?