mirror of
https://github.com/mudabbir-ahmad/web-project.git
synced 2026-10-07 20:20:20 +00:00
new file: .config/configstore/update-notifier-npm.json new file: .config/configstore/update-notifier-npm.json.2701252402 new file: .replit new file: .vscode/launch.json new file: Internet.html new file: about.html new file: case.html new file: cooling.html new file: cpu.html new file: css/about.css new file: css/home.css new file: css/log copy.css new file: css/log.css new file: css/parts.css new file: css/pc.css new file: css/profile.css new file: global.css new file: global.js new file: gpu.html new file: hdd.html new file: home.html new file: images/pc-case.png new file: images/sal.jpeg new file: includes/dbh.inc.php new file: includes/functions.inc.php new file: includes/login.inc.php new file: includes/signup.inc.php new file: index.html new file: js/log copy.js new file: js/log.js new file: keyb.html new file: log copy.html new file: log.html new file: monitor.html new file: mouse.html new file: pc.html new file: profile.html new file: psu.html new file: ram.html new file: register.html new file: replit.nix new file: ssd.html
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
// makes it so the nav bar follows you as you scroll
|
|
window.onscroll = function() {myFunction()};
|
|
var navbar = document.getElementById("navbar");
|
|
var sticky = navbar.offsetTop;
|
|
function myFunction() {
|
|
if (window.pageYOffset >= sticky) {
|
|
navbar.classList.add("sticky")
|
|
} else {
|
|
navbar.classList.remove("sticky");
|
|
}
|
|
}
|
|
|
|
|
|
// for card allignment - allows filtering of results
|
|
function showAllCards() {
|
|
const cards = document.querySelectorAll(`.card`);
|
|
|
|
cards.forEach((item) => {
|
|
item.style.display = null;
|
|
});
|
|
|
|
document.getElementById("all").setAttribute('data-selected', true);
|
|
document.querySelectorAll(`.pill:not([id="all"])`).forEach((pill) => pill.removeAttribute("data-selected"));
|
|
}
|
|
|
|
function showCategory(category) {
|
|
const CategoryItems = document.querySelectorAll(`.card[data-${category}]`);
|
|
const AllElse = document.querySelectorAll(`.card:not([data-${category}])`);
|
|
document.getElementById(category).setAttribute('data-selected', true);
|
|
document.querySelectorAll(`.pill:not([id="${category}"])`).forEach((pill) => pill.removeAttribute("data-selected"));
|
|
|
|
CategoryItems.forEach((item) => {
|
|
item.style.display = null;
|
|
});
|
|
|
|
AllElse.forEach((item) => {
|
|
item.style.display = 'none';
|
|
});
|
|
|
|
document.getElementById("all").removeAttribute('data-selected');
|
|
} |