IMPROVEMENT: Detect touch screen

This commit is contained in:
Tony Air 2020-02-18 01:47:05 +07:00
parent b994d98685
commit b4365f9b75
5 changed files with 14 additions and 14 deletions

2
dist/js/app.js vendored

File diff suppressed because one or more lines are too long

2
dist/js/app.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "@a2nt/ss-bootstrap-ui-webpack-boilerplate",
"version": "1.7.8",
"version": "1.7.9",
"author": "Tony Air <tony@twma.pro>",
"license": "MIT",
"description": "This UI Kit allows you to build Bootstrap 4 webapp with some extra UI features. It's easy to extend and easy to convert HTML templates to CMS templates.",

View File

@ -7,7 +7,7 @@ import $ from 'jquery';
import Events from '../_events';
import 'jquery-hoverintent/jquery.hoverIntent.js';
const HoverUI = ($ => {
const HoverUI = (($) => {
// Constants
const W = window;
const D = document;
@ -36,8 +36,8 @@ const HoverUI = ($ => {
$target = $target
? $target
: $parent
? $parent.find('.dropdown-menu')
: null;
? $parent.find('.dropdown-menu')
: null;
if (!$target || !$target.length) {
console.warn(`${NAME}: Missing target for:`);
@ -51,7 +51,7 @@ const HoverUI = ($ => {
ui.$triger = $triger;
// integrate with dropdown-toggle
$('[data-toggle="dropdown"]').on('click touch', e => {
$('[data-toggle="dropdown"]').on('click touch', (e) => {
ui.hide();
});
@ -68,7 +68,7 @@ const HoverUI = ($ => {
});
}
$el.on('click touch', e => {
$el.on('click touch', (e) => {
if (
!$el.data('allow-click') ||
(W.IsTouchScreen && !$el.data('allow-touch-click'))
@ -154,7 +154,7 @@ const HoverUI = ($ => {
});
// rewrite 'bootstrap/js/dist/dropdown'
$('[data-toggle="dropdown"]').on('click touch', e => {
$('[data-toggle="dropdown"]').on('click touch', (e) => {
e.preventDefault();
const $el = $(e.currentTarget);

View File

@ -15,7 +15,7 @@ import FormBasics from './_components/_ui.form.basics';
import SmoothScroll from 'smooth-scroll';
const smoothScroll = SmoothScroll();
const MainUI = ($ => {
const MainUI = (($) => {
// Constants
const W = window;
const D = document;
@ -127,7 +127,7 @@ const MainUI = ($ => {
};
let eventFired = false;
const setTouchScreen = bool => {
const setTouchScreen = (bool) => {
if (W.IsTouchScreen === bool || eventFired) {
return;
}
@ -216,7 +216,7 @@ const MainUI = ($ => {
//
// scroll links
$('.js-scrollTo').on('click', e => {
$('.js-scrollTo').on('click', (e) => {
e.preventDefault();
const el = e.currentTarget;
const $el = $(e.currentTarget);
@ -245,7 +245,7 @@ const MainUI = ($ => {
}
// data-set links
$('[data-set-target]').on('click', e => {
$('[data-set-target]').on('click', (e) => {
const $el = $(e.currentTarget);
const $target = $($el.data('set-target'));
@ -269,7 +269,7 @@ const MainUI = ($ => {
});
// emulate links
$('.a[data-href]').on('click', e => {
$('.a[data-href]').on('click', (e) => {
const $el = $(e.currentTarget);
const href = $el.data('href');
if (!href.length) {