An Elegant Horizontal Navigation Bar with Smooth Scrolling and Div Anchor Tags

Looking to design a unique sticky horizontal scrolling navigation bar for displaying dates like 1800, 1801, 1802, etc. as part of a timeline project.

The idea is to have the dates scroll horizontally within the navbar while I scroll down the page, aligning with the specific section I am viewing.

In addition, each date should function as a link in the navbar, smoothly scrolling vertically to the corresponding section on the page.

However, I'm facing an issue where the dates overflow off the webpage when adding overflow:hidden to achieve this effect.

Here's what I've managed to do so far:

 <div class="navbar">
        <a href="#dag1">1839</a>
        <a href="#">1840</a>
        <a href="#">1841</a>
        <a href="#">1842</a>
        <a href="#">1843</a>
        <a href="#">1844</a>
        <a href="#">1845</a>
        <a href="#">1846</a>
        <a href="#">1847</a>
        <a href="#">1848</a>
        <a href="#">1849</a>
        <a href="#fact1">1861</a>
        <a href="#brownie1">1900</a>
        <a href="#polaroid1">1948</a>
        <a href="#konica1">1978</a>
        <a href="#kodak1">1991</a>
        <a href="#canon1">2005</a>

And here's the CSS:

.navbar {
    list-style-type: none;
    width:100%;
    height:75px;
    position:fixed;
    top:0;
    text-decoration: none;
    float:left;
    overflow: hidden;
}

You can take a look at a similar example here:

Answer №1

If you're in need of a sticky navigation, look no further.

ul {
 position:fixed; /* this is what makes it sticky */
 width:33%;
}

li {
 float:left;
 margin-left:1%;
 list-style-type:none;
 padding:4%;
 border:1px solid black;
 background-color:#999;
}

http://codepen.io/UniqueCoder/pen/qWxyzA

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Modify the default navbar from Bootstrap to display as a fixed navbar

Is there a way to change my default navbar into a fixed navbar when I scroll? I have tried adding data-spy="affix" data-offset-top="200", which works but doesn't look quite right. Should I create a new CSS class or is there an easier solution availab ...

Updating or deleting a specific database row on a website by utilizing jQuery Ajax

Requesting assistance from anyone willing to take a moment to help document how to accomplish this task, for both myself and others. I am seeking a jQuery AJAX method that can update or delete a specified row in a database table. While I understand the PH ...

Is there a method to view text options that are too long within a fixed width <select multiple> HTML box?

Here is the code I am working with: <div id='div2' style='height: 430px; width: 350px; overflow:auto;'> <select multiple id="id" size="28" style="FONT-SIZE: 12px; FONT-FAMILY: Arial; width: 100%"> It's a challenge bec ...

Move on to a different screen in a React Component once the data has been fetched

Currently, I am delving into the world of React and TypeScript and attempting to utilize "react-router-dom" in order to create a login component that will interact with my backend server. Essentially, my goal is to develop a "Login" class that, upon form ...

Error: Collection2 validation did not pass: The field 'name' must be filled in, the field 'email' cannot be empty, and the field 'message' is mandatory

I need to set up a way for visitors to send messages through my website const mongoose = require("mongoose"); mongoose.connect("MongoDb-Connection-Uri") .then(() => { console.log("mongodb connected"); }) .catch(() => { console.log("fail ...

Stop the resizing of a div that contains an image when additional text is inserted into it

My website has a div that is centered and contains a picture. The div adjusts its height to fit the picture, but when I add text, the div unexpectedly resizes so that its height is taller than the picture itself. Here is an example: Html: <div class=" ...

Tips for transferring data to an entry component in Angular 2 using ng-bootstrap modal

I've been grappling with sending data to a custom modal content component in Angular 2. My objective is to have the flexibility of calling this modal from any other component without duplicating code. Despite my efforts, including referencing the "Com ...

Issue occurred: The error "Undefined offset 1" was encountered while trying to upload a file via

Every time I try to pass data into my file upload controller, I keep encountering an error message that says undefined offset: 1. function TestFileUpload() { $i=0; if(!isset($_FILES[$i]) ) { echo "No file is being uploaded"; } el ...

What is the correct way to incorporate Regular Expressions in Selenium IDE coding?

Using regular expressions to check for a correct answer from a prompt has been challenging. The current expression seems to be giving unexpected results, marking valid answers as false. For instance, when inputting the number 3, Selenium indicates that the ...

Sequencing Controller Actions and/or promises with a single button press

Currently, my project is functioning about 75% of the time. I create reports, add them to a zip file, and then unzip them to a specific location. When running in debug mode, everything works correctly. However, when run normally, sometimes the ajax runs ou ...

Creating a unique design for a CSS menu with distinct section dividers and stylish onHover effects

Hey there! I'm currently working on a new menu design using UL and LIs elements. I would really appreciate some advice on how to add lines after each LI and properly indent them with the specific bullet image I have chosen. If you're interested ...

Generating dynamic JSON arrays to create multiple data tables

I need to generate multiple datatables for each jsonobject [which represents weekly attendance data] in the jsonarray. By making an ajax request, I am retrieving the JSON Array from Java. Can someone guide me on how to create multiple datatables for each ...

What are the ways to utilize vue-i18n setup within and beyond Vue components when working with Quasar?

Hello, fellow developers. I am currently working on implementing internationalization in Quasar, using Vue 3 (Composition API) and vue-i18n. My goal is to make internationalization available throughout the entire application, not just within Vue components ...

What could be the reason that step 3 of the AngularJS Tutorial is not functioning correctly?

During Step 3 of the AngularJS Tutorial, an additional e2e test is recommended to enhance the example: it('should display the current filter value within an element with id "status"', function() { expect(element('#status').text() ...

javascript identifying a variable within location.href

Within my JavaScript code, there is a variable that holds a value: var selectedItemId = null; // the value is assigned by another function Next, there is a function defined like this: function editLink() { location.href = /*[[@{/supplycontracts/edit ...

The issue of the background image not updating with jQuery persists in Internet Explorer 11

Hello everyone, I am facing an issue where I am trying to change the background image of a div using jQuery on click. The code I have written works perfectly on all browsers except for IE. Can someone please provide me with some guidance or help on how to ...

The hyperlink is unclickable because of the menu

The code below contains a menu on the right side with a hover effect and some content with a link. However, the link is not clickable due to the menu. .menubar{position: fixed;right:0;top: 50%;transform: translateY(-50%);-webkit-transform: translateY(-5 ...

When attempting to install React Native on a Mac using the "npx react-native init MyTestApp" command, the

PROBLEM I am encountering difficulties while attempting to install and execute the react native todo command - npx react-native init MyTestApp on my MacBook Pro. The specific challenges I am facing are: The detailed github issue can be found here: here ...

Is there a way to transform text input into a dropdown menu that dynamically alters the rows of a table?

Currently, I am working on creating a drop-down menu selection that will dynamically change the table rows based on user input. At the moment, users can enter their input into a text field to see changes in the table rows. However, I would like to impleme ...

Route Separation with ExpressJS and Socket.IO

As I delve into the world of ExpressJS and Socket.IO, I find myself facing a puzzling situation. My routes are neatly organized in a separate file that I include from my app.js: var express = require('express') , db = require('./db&ap ...