1
|
import { $, docElement as doc, hasTouch, isWithin, ready } from '../util/index';
|
2
|
|
3
|
export default function (UIkit) {
|
4
|
|
5
|
ready(() => {
|
6
|
|
7
|
if (!hasTouch) {
|
8
|
return;
|
9
|
}
|
10
|
|
11
|
var cls = 'uk-hover';
|
12
|
|
13
|
doc.on('tap', ({target}) => $(`.${cls}`).filter((_, el) => !isWithin(target, el)).removeClass(cls));
|
14
|
|
15
|
Object.defineProperty(UIkit, 'hoverSelector', {
|
16
|
|
17
|
set(selector) {
|
18
|
doc.on('tap', selector, ({currentTarget}) => currentTarget.classList.add(cls));
|
19
|
}
|
20
|
|
21
|
});
|
22
|
|
23
|
UIkit.hoverSelector = '.uk-animation-toggle, .uk-transition-toggle, [uk-hover]';
|
24
|
|
25
|
});
|
26
|
|
27
|
}
|