Skip to content

Instantly share code, notes, and snippets.

View FrankFonts's full-sized avatar
🏠
Working from home

Frank Fonts FrankFonts

🏠
Working from home
View GitHub Profile
@FrankFonts
FrankFonts / url-first-parameter-detection.js
Created June 14, 2022 10:42
URL First Parameter Detection
// get the FIRST url parameter
// between the start of query string (? excluded)
// and the first separator (& excluded)
"use strict";
window.onload = () => {
// Optional Chaining and Nullish Coalescing
@FrankFonts
FrankFonts / get-property-value.js
Created June 14, 2022 12:06
getPropertyValue in JS
let tabs = document.querySelector('.tab__links');
let tabsPaddingLeft = parseInt(window.getComputedStyle(tabs, null).getPropertyValue('padding-left'));
@FrankFonts
FrankFonts / tab-selector.js
Created June 29, 2022 11:13
Tab Selector
"use strict";
window.addEventListener("load", function () {
var tabLinks = document.querySelectorAll(".search-results__tab-link");
var tabs = document.querySelectorAll(".search-results__tab");
tabLinks.forEach(function (element) {
element.addEventListener("click", function (event) {
activateTab(event.target.dataset.tabId);
});
<ng-container *ngTemplateOutlet="navigation; context: {classes: 'desktop', label: 'desktop'}"></ng-container>
<ng-container *ngTemplateOutlet="navigation; context: {classes: 'mobile', label: 'mobile'}"></ng-container>
<ng-template #navigation let-classes="classes" let-label="label">
<div [ngClass]="classes">
{{ label }}
</div>
</ng-template>