function rgbaToAndroid1(rgba) {
const c = new Uint8Array([
rgba[2],
rgba[1],
rgba[0],
Math.round(rgba[3] * 255)
]);
return new Uint32Array(c.buffer)[0];
}
// либо
function rgbaToAndroid2(rgba) {
let color = 0;
for (let i = 0; i < 3; i++) {
color += rgba[i] * 2 ** ((2 - i) * 8);
}
color += Math.round(rgba[3] * 255) * 2 ** (3 * 8);
return color;
}
console.log(rgbaToAndroid1([255, 122, 107, 1]));
console.log(rgbaToAndroid2([255, 122, 107, 1]));
function createTable(el) {
for (let i = 0, row; i < el.length; i++) {
if (i % 7 === 0) {
row = document.createElement('tr');
thead.appendChild(row);
}
const cell = document.createElement('th');
cell.innerHTML = el[i];
row.appendChild(cell);
}
}
function checkingReading() {
let prevTimeStamp = performance.now();
chatbox.addEventListener("DOMSubtreeModified", (e) => {
const dt = e.timeStamp - prevTimeStamp;
prevTimeStamp = e.timeStamp;
const changesPerSecond = 1000 / dt;
console.log(changesPerSecond)
});
}
main.css
/* Media Queries */
/* Mobile Devices - Phones/Tablets */
@media only screen and (max-width: 991px) {
/* MOBILE NAVIGATION */
.navbar ul.nav {
display: flex;
flex-direction: column;
position: fixed;
justify-content: start;
top: 15vh;
+ left: 0;
background-color: #999;
width: 100%;
height: 100vh;
transform: translate(100%);
-webkit-transform: translate(100%);
text-align: center;
overflow: hidden;
padding: 15px 30px;
}
overflow: visible
для svg https://jsfiddle.net/hbtg1dqs/ <script setup>
import { directive as vClickAway } from "vue3-click-away";
const onClickInside = (event) => {
console.log('onClickInside: ', event);
};
</script>
<div class="title"> заголовок заголовок заголовок </div>
<div class="description"> текст текст текст текст </div>
<button class="action"> кнопка </button>
body {
display: grid;
grid-template-columns: 1fr min-content;
align-items: center;
}
.title {
grid-column: 1 / -1;
}