mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-27 09:29:59 -04:00
FEATURE: Dynamically calculate the height of search box to accomodate small data sets and different screen sizes.
This commit is contained in:
parent
4d75b532ef
commit
5493c07db5
@ -47,7 +47,7 @@ strongs {
|
|||||||
@media screen and (min-width: 750px) {
|
@media screen and (min-width: 750px) {
|
||||||
strongs {
|
strongs {
|
||||||
ion-scroll {
|
ion-scroll {
|
||||||
height: 400px;
|
height: 250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.strongs-def {
|
.strongs-def {
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
ion-scroll {
|
ion-scroll {
|
||||||
height: 300px;
|
height: 275px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
ion-scroll {
|
ion-scroll {
|
||||||
height: 350px;
|
height: 275px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
ion-scroll {
|
ion-scroll {
|
||||||
height: 350px;
|
height: 300px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
ion-scroll {
|
ion-scroll {
|
||||||
height: 350px;
|
height: 300px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,5 @@
|
|||||||
import { EventEmitter, Component, Input, Output } from "@angular/core";
|
/// <reference path="../../../typings/browser/ambient/jquery/index.d.ts" />
|
||||||
|
import { HostListener, EventEmitter, Component, Input, Output, AfterViewChecked } from "@angular/core";
|
||||||
import { Reference } from '../../libs/Reference';
|
import { Reference } from '../../libs/Reference';
|
||||||
import { OpenData, CardItem } from "../../pages/search/search";
|
import { OpenData, CardItem } from "../../pages/search/search";
|
||||||
|
|
||||||
@ -6,7 +7,7 @@ import { OpenData, CardItem } from "../../pages/search/search";
|
|||||||
selector: "words",
|
selector: "words",
|
||||||
templateUrl: "words.html"
|
templateUrl: "words.html"
|
||||||
})
|
})
|
||||||
export class Words
|
export class Words implements AfterViewChecked
|
||||||
{
|
{
|
||||||
@Output()
|
@Output()
|
||||||
onClose = new EventEmitter<CardItem>();
|
onClose = new EventEmitter<CardItem>();
|
||||||
@ -17,10 +18,69 @@ export class Words
|
|||||||
@Input()
|
@Input()
|
||||||
cardItem: CardItem;
|
cardItem: CardItem;
|
||||||
|
|
||||||
|
$: any;
|
||||||
|
|
||||||
constructor()
|
constructor()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@HostListener('window:resize', ['$event'])
|
||||||
|
onResize(evt)
|
||||||
|
{
|
||||||
|
$("words ion-scroll").each((i, el) =>
|
||||||
|
{
|
||||||
|
let wr = $(el).find(".scroll-content .scroll-zoom-wrapper")[0];
|
||||||
|
let len = $(el).find(".scroll-zoom-wrapper a").length;
|
||||||
|
|
||||||
|
if (wr.scrollWidth < 500) // 1 col
|
||||||
|
{
|
||||||
|
if (len < 6) // 5 rows
|
||||||
|
$(el).css("height", len * 44.4 + 25);
|
||||||
|
else
|
||||||
|
$(el).css("height", 250);
|
||||||
|
}
|
||||||
|
else if (wr.scrollWidth < 699) // 2 col
|
||||||
|
{
|
||||||
|
if (len < 13) // 6 rows
|
||||||
|
$(el).css("height", Math.ceil(len / 2) * 44.4 + 25);
|
||||||
|
else
|
||||||
|
$(el).css("height", 300);
|
||||||
|
}
|
||||||
|
else if (wr.scrollWidth < 799) // 3 col
|
||||||
|
{
|
||||||
|
if (len < 22) // 7 rows
|
||||||
|
$(el).css("height", Math.ceil(len / 3) * 44.4 + 25);
|
||||||
|
else
|
||||||
|
$(el).css("height", 350);
|
||||||
|
}
|
||||||
|
else if (wr.scrollWidth < 899) // 4 col
|
||||||
|
{
|
||||||
|
if (len < 29) // 7 rows
|
||||||
|
$(el).css("height", Math.ceil(len / 4) * 44.4 + 25);
|
||||||
|
else
|
||||||
|
$(el).css("height", 350);
|
||||||
|
}
|
||||||
|
else if (wr.scrollWidth < 1199) // 5 col
|
||||||
|
{
|
||||||
|
if (len < 41) // 8 rows
|
||||||
|
$(el).css("height", Math.ceil(len / 5) * 44.4 + 25);
|
||||||
|
else
|
||||||
|
$(el).css("height", 400);
|
||||||
|
}
|
||||||
|
else // 6 col
|
||||||
|
{
|
||||||
|
if (len < 49) // 8 rows
|
||||||
|
$(el).css("height", Math.ceil(len / 6) * 44.4 + 25);
|
||||||
|
else
|
||||||
|
$(el).css("height", 400);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public ngAfterViewChecked(): void
|
||||||
|
{
|
||||||
|
this.onResize(null);
|
||||||
|
}
|
||||||
|
|
||||||
close()
|
close()
|
||||||
{
|
{
|
||||||
this.onClose.emit(this.cardItem);
|
this.onClose.emit(this.cardItem);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
.search-card {
|
.search-card {
|
||||||
p {
|
p {
|
||||||
margin: 1em 0;
|
margin: 1em 0;
|
||||||
line-height: 1em;
|
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user