提交 25c8f254 编写于 作者: L leon.shi

uninstall the old instance before initialize a new one #3

上级 3ef231cb
/* /*
* pagination.js 2.0.6 * pagination.js 2.0.7
* A jQuery plugin to provide simple yet fully customisable pagination. * A jQuery plugin to provide simple yet fully customisable pagination.
* https://github.com/superRaytin/paginationjs * https://github.com/superRaytin/paginationjs
* *
...@@ -869,6 +869,9 @@ ...@@ -869,6 +869,9 @@
} }
return this; return this;
} else {
// Uninstall the old instance before initialize a new one
uninstallPlugin(container);
} }
} }
else{ else{
...@@ -1083,6 +1086,22 @@ ...@@ -1083,6 +1086,22 @@
} }
} }
// uninstall plugin
function uninstallPlugin(target) {
var events = ['go', 'previous', 'next', 'disable', 'enable', 'refresh', 'show', 'hide', 'destroy'];
// off events of old instance
$.each(events, function(index, value) {
target.off(eventPrefix + value);
});
// reset pagination data
target.data('pagination', {});
// remove old
$('.paginationjs', target).remove();
}
// Object type detection // Object type detection
function getObjectType(object, tmp) { function getObjectType(object, tmp) {
return ( (tmp = typeof(object)) == "object" ? object == null && "null" || Object.prototype.toString.call(object).slice(8, -1) : tmp ).toLowerCase(); return ( (tmp = typeof(object)) == "object" ? object == null && "null" || Object.prototype.toString.call(object).slice(8, -1) : tmp ).toLowerCase();
......
此差异已折叠。
/* /*
* pagination.js 2.0.6 * pagination.js 2.0.7
* A jQuery plugin to provide simple yet fully customisable pagination. * A jQuery plugin to provide simple yet fully customisable pagination.
* https://github.com/superRaytin/paginationjs * https://github.com/superRaytin/paginationjs
* *
...@@ -869,6 +869,9 @@ ...@@ -869,6 +869,9 @@
} }
return this; return this;
} else {
// Uninstall the old instance before initialize a new one
uninstallPlugin(container);
} }
} }
else{ else{
...@@ -1083,6 +1086,22 @@ ...@@ -1083,6 +1086,22 @@
} }
} }
// uninstall plugin
function uninstallPlugin(target) {
var events = ['go', 'previous', 'next', 'disable', 'enable', 'refresh', 'show', 'hide', 'destroy'];
// off events of old instance
$.each(events, function(index, value) {
target.off(eventPrefix + value);
});
// reset pagination data
target.data('pagination', {});
// remove old
$('.paginationjs', target).remove();
}
// Object type detection // Object type detection
function getObjectType(object, tmp) { function getObjectType(object, tmp) {
return ( (tmp = typeof(object)) == "object" ? object == null && "null" || Object.prototype.toString.call(object).slice(8, -1) : tmp ).toLowerCase(); return ( (tmp = typeof(object)) == "object" ? object == null && "null" || Object.prototype.toString.call(object).slice(8, -1) : tmp ).toLowerCase();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册