IMPROVEMENT: auto-size embed elements

This commit is contained in:
Tony Air 2019-12-31 18:55:51 +07:00
parent b6c80e762a
commit ca678eb090
3 changed files with 27 additions and 19 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@a2nt/ss-bootstrap-ui-webpack-boilerplate",
"version": "1.5.2",
"version": "1.5.3",
"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

@ -1,13 +1,13 @@
/*
* Conflicts with 'bootstrap/js/dist/dropdown'
*/
"use strict";
'use strict';
import $ from 'jquery';
import Events from '../_events';
import 'jquery-hoverintent/jquery.hoverIntent.js';
const HoverUI = (($) => {
const HoverUI = ($ => {
// Constants
const W = window;
const D = document;
@ -33,7 +33,11 @@ const HoverUI = (($) => {
// find target
let $target = $el.data('target');
$target = $target && $target.length ? $target : null;
$target = $target ? $target : ($parent ? $parent.find('.dropdown-menu') : null);
$target = $target
? $target
: $parent
? $parent.find('.dropdown-menu')
: null;
if (!$target || !$target.length) {
console.warn(`${NAME}: Missing target for:`);
@ -47,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();
});
@ -64,9 +68,8 @@ const HoverUI = (($) => {
});
}
$el.on('click touch', (e) => {
$el.on('click touch', e => {
if (!$el.data('allow-click')) {
console.log('aaaa');
e.preventDefault();
}
@ -86,11 +89,14 @@ const HoverUI = (($) => {
show() {
const ui = this;
ui.$el.parents('.dropdown').not('.active').each((i, el) => {
const $el = $(el);
$el.find('.dropdown').removeClass('show');
$el.addClass('show');
});
ui.$el
.parents('.dropdown')
.not('.active')
.each((i, el) => {
const $el = $(el);
$el.find('.dropdown').removeClass('show');
$el.addClass('show');
});
ui.$target.addClass('show');
}
@ -144,7 +150,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);
@ -157,7 +163,6 @@ const HoverUI = (($) => {
$parent.addClass('show');
$parent.find('.dropdown-menu').addClass('show');
}
});
return HoverUI;

View File

@ -1,6 +1,6 @@
@import "../_variables";
@import '../_variables';
@import "~bootstrap/scss/tables";
@import '~bootstrap/scss/tables';
img,
.captionImage,
@ -42,6 +42,7 @@ img,
iframe {
width: 100% !important;
height: 100% !important;
}
}
@ -75,7 +76,9 @@ table {
&.table-none {
border: 0;
tr, td, th {
tr,
td,
th {
border: 0;
background: none !important;
}
@ -89,9 +92,9 @@ ul {
list-style: none;
&:before {
content: "\2022";
content: '\2022';
display: inline-block;
margin-right: .5em;
margin-right: 0.5em;
}
}
}