@kizmann/pico-js 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pico-js.js +1 -1
- package/dist/pico-js.js.map +1 -1
- package/package.json +1 -1
- package/src/utility/dom.js +13 -5
package/package.json
CHANGED
package/src/utility/dom.js
CHANGED
@@ -202,11 +202,19 @@ export class Dom
|
|
202
202
|
return top <= scroll.top && scroll.top <= bottom;
|
203
203
|
}
|
204
204
|
|
205
|
-
static inviewMaxY(selector,
|
205
|
+
static inviewMaxY(selector, callback = null, context = null)
|
206
206
|
{
|
207
|
-
let items = [
|
207
|
+
let [items, attr] = [
|
208
|
+
[], selector.replace(/^\[([^="]+)]$/, '$1')
|
209
|
+
];
|
208
210
|
|
209
|
-
Dom.find(selector)
|
211
|
+
let parent = Dom.find(selector);
|
212
|
+
|
213
|
+
if ( ! Any.isNull(context) ) {
|
214
|
+
parent = Dom.find(context);
|
215
|
+
}
|
216
|
+
|
217
|
+
parent.each((el) => {
|
210
218
|
items.push({ el, height: Dom.find(el).inviewHeight() });
|
211
219
|
});
|
212
220
|
|
@@ -216,8 +224,8 @@ export class Dom
|
|
216
224
|
return item.height === Math.max(...heights);
|
217
225
|
});
|
218
226
|
|
219
|
-
if ( ! Any.isEmpty(el) && Any.isFunction(
|
220
|
-
|
227
|
+
if ( ! Any.isEmpty(el) && Any.isFunction(callback) ) {
|
228
|
+
callback.call({}, el.el, el.el.getAttribute(attr));
|
221
229
|
}
|
222
230
|
|
223
231
|
return el.el;
|