The smooth scrolling effect I had programmed suddenly came to a halt

I have a simple jQuery script that allows for smooth navigation through a website using animated scrolling.

jQuery(".main_menu li a").click(function() {

    var href = jQuery(this).attr('href');

    if(jQuery(this).html() == 'Home') {
        jQuery("html, body").animate({ scrollTop: jQuery('body').offset().top }, 1000);
    }
    else {
        jQuery("html, body").animate({ scrollTop: jQuery(href).offset().top }, 1000);

    }

    return false;

});

Recently, after making some unrelated changes to the CSS and template of the website, the scrolling functionality suddenly stopped working. Now, I can only scroll to the top of the page by clicking on "Home". Even running the scrolling code in the console doesn't seem to help. I've tried undoing the recent changes, but the issue persists, leaving me puzzled and searching for a solution.

Here's the live version.

Answer №1

The issue at hand is that

All Section id's is getting duplicated
. Specifically, the section id values for woda,oferta, o-firmie, galeria, and kontakt are all being duplicated in the HTML markup. To resolve this, simply update the duplicate id values for each section and the problem will be resolved.

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

Is it possible for the vertical borders of <span> to overlap?

When nesting multiple spans within each other and giving them borders, their horizontal borders overlap by default while their vertical borders stack. Check out a live example on JsFiddle: https://jsfiddle.net/4un9tnxy/ .html: <span><span>a& ...

The entered value in the <input> field is not valid

I am encountering an issue where the input value is auto-filled, but when I click the submit button, the input field value is not recognized unless I modify something in it, such as deleting and adding the last word to the first name. Is there a way to m ...

Using jQuery to display handlebar helpers

I am working on inserting a code snippet into my main template (using handlebars) with the help of jquery. var addSnippet = function(data){ return ` <div class='some class'> {{{formatDate ${data.created_at} 'MMM DD ...

Tips for maintaining i18n locale slugs and ensuring i18n consistency when reloading in Next.js

I'm currently utilizing next-translate. The default recognition of my routes is as follows: /about <--- /de/about /es/about However, I would like to set a specific locale for all paths: /en/about <--- /de/about /es/about Below is ...

Adjust the width of the react-bootstrap container

Is there a way to make the default container width in Bootstrap smaller while ensuring it remains consistent across all viewports? I am looking to decrease the total width of the container, making it relatively shorter than its current size. How can I ach ...

What is the best way to store a file object in React's state?

I am currently working on setting the state for a file object that is being passed between modals before it is uploaded to the server. Below is the code snippet that demonstrates what I am attempting to achieve. const initialState = { selectedD ...

bespoke filter designed to conceal any negative figures

I am trying to implement a feature where a text box will display nothing if the ng-model contains a negative value. I want the ng-model to remain unchanged while ensuring that negative values are not displayed. I am looking for a custom filter to achieve t ...

Updating data in a table using identifiers from another table

I would greatly appreciate any assistance in advance! Within my database, I have two tables - var table and val table. var table varid image vartype val table valid sig winner varid These tables are related in a one-to-many relationship, indicating t ...

Issue with JavaScript focus not functioning properly

Why is the Javascript focus not working in the following code snippet? HTML <div class="col-md-6" style="border:none; margin-top:2px; padding-right:5px"> <input type="text" id="edtunt" ng-model="Unit" class="form-control" placeholder="Edit ...

Dynamically remove values from other fields in a React Formik form based on checkbox conditions

Currently, I am utilizing react-formik for my form implementation. I have encountered an issue with checkbox-based conditions where the checked status of a checkbox determines whether two hidden fields are displayed or hidden. If the user checks the checkb ...

Encountering problems when trying to establish a connection to my MySQL database while utilizing a REST API server built

As a newcomer to coding servers and JavaScript, I am currently taking steps to establish a REST API server and connect it with my SQL database locally. My setup involves running Ubuntu 18.04 with NODE js. So far, I have managed to successfully create a RES ...

What's the deal with inline blocks and text in the middle?

Check out this code I created for a navigation bar. HTML : <div class="header-nav"> <div class="header"> <img src="../Pictures/LifeFrame/2.jpg" width="100%" height="100px" /> </div> <div class="nav" align="c ...

Is it possible to call componentDidMount() multiple times in React?

I am in the process of converting an HTML API to ReactJS. The original HTML API is as follows: <script src="//dapi.kakao.com/v2/maps/sdk.js?appkey=3199e8f198aff9d5aff73000faae6608"></script> <script> var mapContainer = document.getE ...

Retrieving various sets of JSON objects arrays

I have successfully stored an array of JSON objects in the database using the following code: function send_custom_markers() { var reponse = confirm("Send markers to selected contacts?"); if (reponse === true) { var json_markers = new ...

How to modify the value of an attribute in a HTML element

I have a photo that I am using with an Image Map in my HTML document Recently, I incorporated some Bootstrap elements to my page, but to make a long story short, I am looking to dynamically change the coordinates of the map areas based on the position of ...

Creating a prototype function in JavaScript

I am attempting to create a JavaScript prototype function that replicates the Python syntax of 'a' in 'abc'. The function works correctly in one example, but not in another. Can you help me identify what mistake I made? String.proto ...

Safari displaying elements without following font styling specified in CSS

I have a select element in my web page, and I've customized the font using CSS: @font-face { font-family: myFont; src: url('myFont.woff'); } body select{ font-family: myFont; } After testing in Chro ...

Create code with a form button and showcase the produced code on the webpage

I have created two files: code_generator.html, which takes input in the form of an image URL and landing URL. When I click on the submit button, it calls code_created.php. <html> <head> </head> <body> <form a ...

Avoid running old JavaScript code when using turbolinks in conjunction with highcharts library, specifically LazyHighCharts

Utilizing turbolinks 5 and rails version 5, along with the latest Highcharts has been causing me some issues. T LazyHighCharts offers a solution for Turbolinks 5 by encapsulating chart building javascript within (function() { document.addEventListe ...

What is the most effective way to align Django form CharFields side by side on a single line?

Currently, I am utilizing the Django Form class to construct a form. My goal is to have each CharField field occupy its own row, with the exception of certain ones that I want to share a row. The following are the CharFields I am currently working with: c ...