jquery扩展插件,让demo元素也可以resize
(function($, h, c) {
var a = $([]),
e = $.resize = $.extend($.resize, {}),
i,
k = "setTimeout",
j = "resize",
d = j + "-special-event",
b = "delay",
f = "throttleWindow";
e[b] = 250;
e[f] = true;
$.event.special[j] = {
setup: function() {
if (!e[f] && this[k]) {
return false
}
var l = $(this);
a = a.add(l);
$.data(this, d, {
w: l.width(),
h: l.height()
});
if (a.length === 1) {
g()
}
},
teardown: function() {
if (!e[f] && this[k]) {
return false
}
var l = $(this);
a = a.not(l);
l.removeData(d);
if (!a.length) {
clearTimeout(i)
}
},
add: function(l) {
if (!e[f] && this[k]) {
return false
}
var n;
function m(s, o, p) {
var q = $(this),
r = $.data(this, d);
r.w = o !== c ? o: q.width();
r.h = p !== c ? p: q.height();
n.apply(this, arguments)
}
if ($.isFunction(l)) {
n = l;
return m
} else {
n = l.handler;
l.handler = m
}
}
};
function g() {
i = h[k](function() {
a.each(function() {
var n = $(this),
m = n.width(),
l = n.height(),
o = $.data(this, d);
if (m !== o.w || l !== o.h) {
n.trigger(j, [o.w = m, o.h = l])
}
});
g()
},
e[b])
}
})(jQuery, this)
jquery扩展插件,让demo元素也可以resize的更多相关文章
- jQuery扩展插件以及正则相关函数练习
一.jQuery扩展插件 二.相关正则函数:
- 滚动加载|页面滑到底部加载数据|jquery.endless-scroll插件|使用demo
<html> <head> <link rel="dns-prefetch" href="http://i.tq121.com.cn&quo ...
- Angular TypeScript开发环境集成jQuery扩展插件
集成步骤: 1.安装jquery极其扩展插件库ts定义文件 npm install jquery --save npm install --save-dev @types/jquery npm ins ...
- jQuery扩展插件
jQuery有多好用,大家有目共睹的,但是有时候不是每个功能都是万能的,有时候我们需要实现自己的功能,jQuery提供了很好的拓展功能,我们可以去拓展插件,更好的利用jQuery 查看官网,可知,有两 ...
- jquery 扩展插件方法
分析插件jquery.countdown.js (function($) { $.fn.countdown = function(options) { // default options var d ...
- JQuery扩展插件Validate—5添加自定义验证方法
从前面的示例中不难看出validate中自带的验证方法足以满足一般的要求,对于特别的要求可以使用addMethod(name,method,message)添加自定义的验证规则,下面的示例中添加了一个 ...
- jQuery扩展插件和拓展函数的写法
<script type="text/JavaScript"> //jQuery插件的写法(需要传入操作对象) ;(function ...
- Jquery定位插件,固定元素在页面某个位置,不随滚动条滚动
代码: (function ($) { "use strict"; $.fn.pin = function (options) { var scrollY = 0, element ...
- jquery编写插件的方法
版权声明:作者原创,转载请注明出处! 编写插件的两种方式: 1.类级别开发插件(1%) 2.对象级别开发(99%) 类级别的静态开发就是给jquery添加静态方法,三种方式 1.添加新的全局函数 2 ...
随机推荐
- C. Line (扩展欧几里得)
C. Line time limit per test 1 second memory limit per test 256 megabytes input standard input output ...
- [mysql][【优化集合】mysql数据库优化集合
三个层面: 1.系统层面 2.mysql配置参数 3.sql语句优化 =========================================================== 一.系统层 ...
- bzoj 1568 [JSOI2008]Blue Mary开公司 超哥线段树
[JSOI2008]Blue Mary开公司 Time Limit: 15 Sec Memory Limit: 162 MBSubmit: 1808 Solved: 639[Submit][Sta ...
- arm开发板刷机方法
1.linux系统启动方式 bootloader->kernel->system 在嵌入式系统中内存为DRAM,inand flash 都不能直接启动需要被初始化.其中初始化程序在(boo ...
- svn update解决冲突
(p) postpone 暂时推后处理,我可能要和那个和我冲突的家伙商量一番 (df) diff-full 把所有的修改列出来,比比看 (e) edit 直接编辑冲突的文件 (mc) mine-con ...
- oracle 存储过程 技巧
我们在进行pl/sql编程时打交道最多的就是存储过程了.存储过程的结构是非常的简单的,我们在这里除了学习存储过程的基本结构外,还会学习编写存储过程时相关的一些实用的知识.如:游标的处理,异常的处理,集 ...
- 1-shell学习(bash)
1.为什么需要学习shell: (1)通用性,基本上所有的linux机器都会支持 (2)文字传输操作更快 (3)以后的系统管理需要使用 2.知识点: (1)变量相关:
- UVA 11105 Semi-prime H-numbers
https://vjudge.net/problem/UVA-11105 筛法 #include<cstdio> #include<cstring> #define N 100 ...
- web开发中防止SQL注入
一.SQL注入简介 SQL注入是比较常见的网络攻击方式之一,它不是利用操作系统的BUG来实现攻击,而是针对程序员编写时的疏忽,通过SQL语句,实现无账号登录,甚至篡改数据库. 二.SQL注入攻击的总体 ...
- 关于ng-if的理论性知识你了解多少?
ng-if简介: ● 使用ng-if指令可以完全根据表达式的值在DOM中生成或移除一个元素.如果赋值给ng-if 的表达式的值是false,那对应的元素将会从DOM中移除,否则对应元素的一个克隆将被重 ...