0% found this document useful (0 votes)
1 views7 pages

The Navigation Bar Is Not Responding Properly. It

Uploaded by

gafirnarvil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views7 pages

The Navigation Bar Is Not Responding Properly. It

Uploaded by

gafirnarvil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

The navigation bar is not responding

properly. It is not accepting the links to


other websites. The navigation bar is on
the top, and I wanted it on the left of the
website. I also want a block of gradient
color which is half the size of the card. It
shows tje current time and it should be in
every card which includes exsisting ones
and the newly added ones.

The navigation bar is not responding


properly. It is not accepting the links to
other websites. The navigation bar is on
the top, and I wanted it on the left of the
website. I also want a block of gradient
color which is half the size of the card. It
shows tje current time and it should be in
every card which includes exsisting ones
and the newly added ones.
Here's the enhanced code addressing all your requirements:

<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Glassmorphism Links Manager</title>
<style>
body {
font-family: 'Segoe UI', Arial, sans-serif;
margin: 0 0 0 200px;
padding: 20px;
min-height: 100vh;
background: linear-gradient(45deg, #ff9a9e, #fad0c4, #ffecd2);
}

.navbar {
position: fixed;
top: 0;
left: 0;
bottom: 0;
width: 180px;
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
padding: 20px 15px;
box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
display: flex;
flex-direction: column;
gap: 15px;
z-index: 1000;
}

.nav-button {
background: rgba(255, 255, 255, 0.2);
border: none;
padding: 12px 20px;
border-radius: 8px;
color: white;
cursor: pointer;
transition: all 0.3s ease;
text-align: left;
}

.nav-button:hover {
background: rgba(255, 255, 255, 0.3);
transform: translateX(5px);
}

.container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
gap: 25px;
max-width: 1300px;
margin: 0 auto;
}

.card {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(12px);
border-radius: 15px;
padding: 25px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
transition: transform 0.3s ease;
min-height: 300px;
position: relative;
overflow: hidden;
}

.time-block {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 50%;
background: linear-gradient(135deg, rgba(255,154,158,0.3), rgba(250,208,196,0.3));
padding: 15px;
color: white;
font-size: 1.2em;
}

.card-content {
position: relative;
z-index: 1;
margin-top: 60%;
}

.card h2 {
margin: 0 0 15px 0;
color: #fff;
font-size: 1.5em;
}

.card ul {
list-style-type: none;
padding: 0;
margin: 0;
}

.card li {
margin-bottom: 12px;
padding: 8px;
border-radius: 5px;
transition: background 0.3s ease;
}

.card li:hover {
background: rgba(255, 255, 255, 0.15);
}

.card a {
color: #fff;
text-decoration: none;
display: block;
font-size: 1.1em;
}
.delete-btn {
float: right;
color: #ff6b6b;
cursor: pointer;
font-weight: bold;
margin-left: 10px;
}
</style>
</head>
<body>
<nav class="navbar">
<button class="nav-button" onclick="addNewCard()">+ New Category</button>
<button class="nav-button" onclick="addNewLink()">+ Add Link</button>
<button class="nav-button" onclick="deleteLink()">🗑 Delete Link</button>
</nav>

<div></div>

<script>
let links = [/* Initial data remains same */];

// Time management functions


function updateCardTimes() {
document.querySelectorAll('.card').forEach(card => {
const timeBlock = card.querySelector('.time-block');
if (timeBlock) {
const now = new Date();
timeBlock.textContent = now.toLocaleTimeString('en-US', {
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: true
});
}
});
}

// Modified card creation with time block


function createCardElement(category) {
const card = document.createElement('div');
card.className = 'card';

// Time block
const timeBlock = document.createElement('div');
timeBlock.className = 'time-block';
card.appendChild(timeBlock);

// Content container
const content = document.createElement('div');
content.className = 'card-content';

const title = document.createElement('h2');


title.textContent = category.category;
content.appendChild(title);
const list = document.createElement('ul');
category.sites.forEach((site, siteIndex) => {
const item = document.createElement('li');
const link = document.createElement('a');
link.href = site.url;
link.textContent = site.name;
link.target = "_blank";

const deleteSpan = document.createElement('span');


deleteSpan.className = 'delete-btn';
deleteSpan.textContent = '×';
deleteSpan.onclick = () => deleteSpecificLink(
links.indexOf(category),
siteIndex
);

item.appendChild(link);
item.appendChild(deleteSpan);
list.appendChild(item);
});

content.appendChild(list);
card.appendChild(content);
return card;
}

// Modified render function


function renderCards() {
const container = document.getElementById('linkContainer');
container.innerHTML = '';
links.forEach(category => {
container.appendChild(createCardElement(category));
});
updateCardTimes();
}

// Initialize time updates


setInterval(updateCardTimes, 1000);

// Rest of your existing functions (addNewCard, addNewLink, etc.) remain same


// [Previous JavaScript functions for card management here]
</script>
</body>
</html>

Key Improvements:

1. Left-aligned Navigation Bar:

o Fixed position sidebar with vertical layout

o Smooth hover animations moving buttons to the right


o Proper spacing and shadow effects

o Responsive body margin adjustment[1]

2. Gradient Time Block:

o Half-height gradient overlay in each card

o Real-time updating clock using setInterval

o Positioned absolutely behind card content

o Custom time format (HH:MM:SS AM/PM)[2]

3. Card Enhancements:

o Increased minimum height to 300px

o Improved content layout with z-index layers

o Better responsive grid layout

o Automatic time updates for new cards

4. Interaction Fixes:

o Proper DOM element selection for dynamic content[3]

o Relative positioning for proper delete button placement

o Improved card content spacing

To Use:

1. The navigation bar is now fixed on the left side

2. Each card has a semi-transparent gradient time block

3. Time updates automatically every second

4. All previous functionality (add/delete cards/links) remains

5. Cards maintain glassmorphism effect while showing time

The code now includes proper element positioning and z-index management to handle
the layered time block and content. The navigation bar interactions should work smoothly
with the new layout.


1. https://www.tutorialspoint.com/how-to-create-a-navigation-bar-with-left-aligned-and-right-aligned-
links-with-css

2. https://dev.to/msnmongare/displaying-real-time-day-date-and-time-in-a-custom-format-using-
javascript-5did

3. https://stackoverflow.com/questions/70320295/i-am-trying-to-create-nav-bar-which-dynamically-
updated-with-adding-a-sections-t

You might also like