(function($, window, document) {}) jQuery 调用解决与其他javascript库冲突的写法
将函数包在红色字体内部,可以解决$符号与其他插件的冲突。
<script type="text/javascript">
(function($, window, document) {
//$(document).ready(function(){
var param_cats = $("input[name='category[]']:checked").val();
if(param_cats == null || param_cats == '') {
param_cats = '0';
}
else {
$('#ehp-topblogs-title').html('Top Blogs in ' + $("input[name='category[]']:checked").next().html() + ':');
// $('#ehp-topblogs-title').html('Top Blogs in All Categories:');
}
var post_data_top_loved = {
action: 'top_loved',
item_cats: param_cats,
top_loved_nonce: top_loved_vars.nonce
};
$.post(top_loved_vars.ajaxurl, post_data_top_loved, function(response) {
$('#divBlogsGroup').html(response);
$('#span-blog-loading').delay(1500).hide();
});
// });
})(jQuery, window, document);
</script>
(function($, window, document) {}) jQuery 调用解决与其他javascript库冲突的写法的更多相关文章
- jQuery避免$符和其他JS库冲突的方法对比
1.如果jquery库在第三方库之后引用.这个时候jquery库会占用$. 解决办法:剔除$符号的使用权. <script type="text/javascript" sr ...
- jQuery noConflict() 方法----与其他javaScript插件冲突时
1,全名代替----jQuery: $.noConflict(); jQuery(document).ready(function(){ jQuery("button").clic ...
- 【原】IOS合并lib(.a)库的终极可用方法(可用于解决duplicate symbol静态库冲突)
网上流传了太多关于合并lib库的方法,自己也尝试过,但大多失败.有感于这种急于解决问题,经过百般尝试后依旧无果的无奈心情,小翁在这里用一个实例来完整阐述如何在mac中合并lib静态库. 这里以移动广告 ...
- JS (function (window, document, undefined) {})(window, document)的真正含义
原文地址:What (function (window, document, undefined) {})(window, document); really means 按原文翻译 在这篇文章中,我 ...
- 详解jquery插件中;(function ( $, window, document, undefined )的作用
在jquery插件中我们经常看到以下这段代码 1 2 3 ;(function ( $, window, document, undefined ){ //函数体内具体代码 })(jQuery, wi ...
- 详解;(function ($,window,document,undefined){...})(jQuery,window,document);
1.代码最前面的分号,可以防止多个文件压缩合并以为其他文件最后一行语句没加分号,而引起合并后语法错误. 2.匿名函数(function(){})();:由于Javascript执行表达式是从圆括号里面 ...
- jquery插件中(function ( $, window, document, undefined )的作用
在jquery插件中我们经常看到以下这段代码 ;(function ( $, window, document, undefined ){ //函数体内具体代码 })(jQuery, window,d ...
- 详解jquery插件中(function ( $, window, document, undefined )的作用。
1.(function(window,undefined){})(window); Q:(function(window,undefined){})(window);中为什么要将window和unde ...
- ;(function($,window,document,undefined){})(jQuery,window,document)
;(function($,window,document,undefined){})(jQuery,window,doucment) 1.自调函数(function(){})() 2.好处是不会产生任 ...
随机推荐
- plain framework 1 参考手册 入门指引之 许可协议
许可 介绍 Apache2 License 介绍 使用非常友好的阿帕奇2许可协议,你可以应用到你想用的任何应用上,如需修改源码,请保留原作者信息. Apache2 License Apache Lic ...
- Uva 11395 Sigma Function (因子和)
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=109329#problem/C 题目在文末 题意:1~n (n:1~1012)中,因子 ...
- ZooKeeper开发手册中文翻译(转)
本文Github地址:https://github.com/sundiontheway/zookeeper-guide-cn 本文假设你已经具有一定分布式计算的基础知识.你将在第一部分看到以下内容: ...
- UVALive 5066 Fire Drill --BFS+DP
题意:有一个三维的地图,有n个人被困住,现在消防队员只能从1楼的一个入口进入,营救被困者,每一个被困者有一个价值,当消防队员找到一个被困者之后,他可以营救或者见死不救,如果救的话,他必须马上将其背到入 ...
- Qt 静态编译后的exe太大, 可以这样压缩.
1. 下载PECompact 下载地址:http://download.csdn.net/download/sniper_bing/7669247 , 不行大家就去baidu搜索下载就可以了这个是绿 ...
- java 25 - 5 网络编程之多线程实现聊天室
平时聊天都是在同一个窗口的,所以,这个窗口同时实现发送数据和接收数据,这时就需要多线程实现. 建立一个类: 把聊天的发送端和接收端放在同一个类,启动一个窗口 public class CharRoom ...
- 虚拟机 centos设置代理上网
假设我们要设置代理为 IP:PORT 1.网页上网 网页上网设置代理很简单,在firefox浏览器下 Edit-->>Preferences-->>Advanced--> ...
- MVC5 条件查询异步刷新
学校要做一个数据查询,按条件并且能下载 20160312 使用HTML.ajax异步刷新 视图层 @Html.Partial("_men") <div class=&quo ...
- saltstack安装配置(halite)
saltstack官方提供了一个简单的web UI--halite.但是给出的安装配置方法实在没法实现,在网上找了几篇博客,见文章末尾的参考链接,可以用起来了.但是功能有点简单.这篇文章记录安装配置h ...
- Ztree 随笔记
Ztree方法是一个单体对象方法,假如一个页面有多个的话,每申明一个新对象前面的Ztree对象就要被覆盖. 解决:在生成tree控件的时候就要设置其控件ID,然后通过$.fn.zTree.getZTr ...