sheikh
sheikh
KPCKevin Powell - Community
Created by sheikh on 12/23/2023 in #front-end
Font family not working on html,css
@font-face {
font-family: 'Main UI';
src: local('./BebasNeue-Regular.ttf'), url('https://fonts.google.com/specimen/Bebas+Neue') format('woff2');
}

html, body {
margin: 0;
padding: 0;
}
#topBar {
position: fixed;
top: 0%;
left: 0%;
width: 100%;
height: 9vh;
z-index: 10;
background-color: #f5f5f5;
}
#textBox {
justify-content: center;
transform: translate(2%, -20%);
}

#navbarText {
display: flex;
justify-content: center;
list-style-type: none;
transform: translate(0%, -12%);
font-size: 6.5vh;
color: #050505;
}

#navbarText li {
font-family: 'Main UI', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
display: inline-block;
margin-right: 10px;
}
@font-face {
font-family: 'Main UI';
src: local('./BebasNeue-Regular.ttf'), url('https://fonts.google.com/specimen/Bebas+Neue') format('woff2');
}

html, body {
margin: 0;
padding: 0;
}
#topBar {
position: fixed;
top: 0%;
left: 0%;
width: 100%;
height: 9vh;
z-index: 10;
background-color: #f5f5f5;
}
#textBox {
justify-content: center;
transform: translate(2%, -20%);
}

#navbarText {
display: flex;
justify-content: center;
list-style-type: none;
transform: translate(0%, -12%);
font-size: 6.5vh;
color: #050505;
}

#navbarText li {
font-family: 'Main UI', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
display: inline-block;
margin-right: 10px;
}
<div id="textBox">
<ul id="navbarText">
<li id="home"><i class="fa fa-home"></i> Home</li>
<li id="shop"><i class="fa fa-shopping-cart"></i> Shop</li>
<li id="about"><i class="fa fa-info-circle"></i> About</li>
</ul>
</div>
<div id="textBox">
<ul id="navbarText">
<li id="home"><i class="fa fa-home"></i> Home</li>
<li id="shop"><i class="fa fa-shopping-cart"></i> Shop</li>
<li id="about"><i class="fa fa-info-circle"></i> About</li>
</ul>
</div>
7 replies
KPCKevin Powell - Community
Created by sheikh on 12/19/2023 in #front-end
Sliding animation not working
the animation not working as intended it is clipping sometimes the element(background) are img elements . the problem seems to happen on this block of js. all the variables are declared (including background.value ones)
async function MovePreviousBackground(Left) {
const transitionPromise = () => {
return new Promise(resolve => {
ActiveBackground.addEventListener('transitionend', function handler() {
resolve();
ActiveBackground.removeEventListener('transitionend', handler);
});
});
};

const applyTransition = async (transform) => {
ActiveBackground.style.transition = `0.5s ease`;
ActiveBackground.style.transform = transform;
await transitionPromise();
};

if (Left) {
if (ActiveBackground.Value < 15) {
await applyTransition(`translate(-100%, 0%)`);
console.log("11");
} else {
await applyTransition(`translate(-100%, 0%)`);
await applyTransition(`translate(-100%, -100%)`);
await applyTransition(`translate(100%, -100%)`);
await applyTransition(`translate(100%, 0%)`);
console.log("10");
}
} else {
if (ActiveBackground.Value < 15) {
await applyTransition(`translate(100%, 0%)`);
await applyTransition(`translate(100%, -100%)`);
await applyTransition(`translate(-100%, -100%)`);
await applyTransition(`translate(-100%, 0%)`);
console.log("01");
} else {
await applyTransition(`translate(100%, 0%)`);
console.log("00");
}
}
}
async function MovePreviousBackground(Left) {
const transitionPromise = () => {
return new Promise(resolve => {
ActiveBackground.addEventListener('transitionend', function handler() {
resolve();
ActiveBackground.removeEventListener('transitionend', handler);
});
});
};

const applyTransition = async (transform) => {
ActiveBackground.style.transition = `0.5s ease`;
ActiveBackground.style.transform = transform;
await transitionPromise();
};

if (Left) {
if (ActiveBackground.Value < 15) {
await applyTransition(`translate(-100%, 0%)`);
console.log("11");
} else {
await applyTransition(`translate(-100%, 0%)`);
await applyTransition(`translate(-100%, -100%)`);
await applyTransition(`translate(100%, -100%)`);
await applyTransition(`translate(100%, 0%)`);
console.log("10");
}
} else {
if (ActiveBackground.Value < 15) {
await applyTransition(`translate(100%, 0%)`);
await applyTransition(`translate(100%, -100%)`);
await applyTransition(`translate(-100%, -100%)`);
await applyTransition(`translate(-100%, 0%)`);
console.log("01");
} else {
await applyTransition(`translate(100%, 0%)`);
console.log("00");
}
}
}
also give a review to the design if you will
3 replies