mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
Better drag interface, start of reorder dragging
This commit is contained in:
28
js/utils/dom.js
Normal file
28
js/utils/dom.js
Normal file
@ -0,0 +1,28 @@
|
||||
(function(ionic) {
|
||||
ionic.DomUtil = {
|
||||
/**
|
||||
* {returns} the closest parent matching the className
|
||||
*/
|
||||
getParentWithClass: function(e, className) {
|
||||
while(e.parentNode) {
|
||||
if(e.parentNode.classList && e.parentNode.classList.contains(className)) {
|
||||
return e.parentNode;
|
||||
}
|
||||
e = e.parentNode;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
/**
|
||||
* {returns} the closest parent or self matching the className
|
||||
*/
|
||||
getParentOrSelfWithClass: function(e, className) {
|
||||
while(e) {
|
||||
if(e.classList && e.classList.contains(className)) {
|
||||
return e;
|
||||
}
|
||||
e = e.parentNode;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
})(window.ionic);
|
||||
Reference in New Issue
Block a user