The numbering in Chrome with slidetoggle is inaccurately displayed by the CSS Counter feature

Description:- The counter is incrementing continuously on slide toggle. It is providing a continuous number to the li outside of ol. The issue is appearing in Chrome, but it works fine in Mozilla. What could be the solution for this?
I have included the output file at the bottom.

<ol class="nav">
    <li>
        <a href="#">Parent-1</a>
        <ol class="nav">
            <li>child1</li>
            <li>child2</li>
        </ol>
    </li>
    <li><a href="#">parent-2</a>
     <ol class="nav">
            <li>
            <a href="#">child-1</a>
            <ol class="nav">
              <li><a href="#">inner-most-1</a></li>
            <li><a href="#">innner-most-2</a></li>
            </ol>

            </li>
            <li><a href="#">child-2</a></li>
        </ol>
    </li>
    <li><a href="#">parent-3</a></li>
</ol>

Jquery

$(function() {
    $(".nav ol").hide();
        $(".nav > li > a").click(function(e) {
            $(this).siblings("ol").slideToggle();
            e.preventDefault();
        });
    });

CSS:-

  ol{
       counter-reset: section;
       list-style-type: none;
        }
     ol li{
       counter-increment: section;
        }
     ol li:before {

     content: counters(section,".") " ";
      }

Output example Another Output

JS_Fiddle:- Link to JSFiddle

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

Position the site at the center of the screen for perfect alignment

As I work on building a website, I am striving to achieve perfect center alignment both horizontally and vertically on the screen. However, despite my efforts, I have only managed to center it horizontally so far. After thorough research, the solutions I ...

Switch up the CSS variable within an embedded iframe

I'm in a predicament with a specific issue. I am currently utilizing Angular to incorporate an Iframe. Let's imagine the angular app as A and the Iframe as B. B is being loaded within A. Within B, I have utilized CSS variables to define colors. I ...

The lack of responsiveness in Bulma CSS is causing issues with the Bulma Carousel and image displays

I recently built a website using the Bulma CSS framework for styling, incorporating the Bulma Carousel for a text carousel. Utilizing Bulma's column feature, I positioned the carousel next to an image/video on the left side of the screen. Everything l ...

The identifier is not being used for the HTML element on the mobile browser

Having some issues with CSS priority on my mobile device. The problem is that the CSS id selector push-content is not being applied to the body element. Surprisingly, it works perfectly fine on my PC browser. The code that's not working on mobile dev ...

Looking to integrate a specific version of the CDP in your project? Consider utilizing a package like selenium-devtools-v86:4.0.0 to avoid any issues with Selenium and jsoup integration

I'm having trouble using the URL of a webpage I accessed through Selenium to open it with Jsoup. Every time I attempt this, I get a console message saying: "WARNING: Unable to find version of CDP to use for . You may need to include a dependency on a ...

Looking to switch the markers from circles to icons in the GeoChart component of react-google-charts

During my personal project, I came across the react-google-charts library and discovered a method to add markers to the map. <Chart width={"200%"} height={"100%"} chartType={"GeoChart"} data={geoData} rootProps={{ "data-testid": "1" ...

What is the best way to position an element on top of a section of a massive image using CSS?

My current project involves creating a demo of my app within the app itself. To give you an idea, check out the images below: https://i.sstatic.net/J4gbS.png https://i.sstatic.net/OAmwK.png Let me provide some context. The large black rectangle represe ...

Footer positioned centrally on screen

My webpage footer seems to be misplaced, appearing in the middle of my content instead of at the bottom where it should be. Surprisingly, the code for the footer works perfectly on other pages. Any suggestions on why this might be happening? I've sco ...

Setting the height and width to 100% causes the element to slightly protrude

After setting the height and width of a canvas to 100%, I noticed that instead of fitting the screen perfectly, it slightly exceeded the boundaries, causing a scroll bar to appear allowing me to scroll just a few pixels up, down, left, or right, even after ...

the else/if statement executes only on the first run

In my current code, when the user inputs a color that matches any of the colors in the array, it will add that color class to the main div. The issue I'm facing is that my else-if statements only run once. If you input the same color again, it won&ap ...

Prevent Chrome from automatically restoring the previous browsing session

Is there a way to prevent Chrome from restoring the session when reopening a closed page? Possibly using a special header? My company app relies heavily on user state, and I need to log employees out and delete all relevant data if they are inactive for 6 ...

What is the best way to ensure consistent heights among my Bootstrap flex child elements?

It has come to my attention that the new version of Bootstrap (v4) utilizes flex to present elements within a box, providing more flexibility for alignment. On my webpage, I am dealing with three boxes that have equal heights. However, the inner white elem ...

Why is the header image not appearing on mobile devices on the website?

I recently finished creating my own website with a header image that successfully expands to the width of the screen during testing on Google Chrome for mobile responsiveness. However, upon deploying and viewing the site on actual mobile devices, the heade ...

JavaScript eliminates any existing CSS styling

I am new to the world of web development and recently created a sample webpage. The page consists of an HTML file, a CSS file, and a JavaScript file. However, I encountered an issue where linking the JavaScript file to the HTML page caused the CSS formatti ...

What is the best approach to effectively manage right-to-left text-input fields?

I have been working on a project involving a multilingual layout. One concern that has arisen is: What is the proper way to handle text-input in this scenario? To better explain my issue, I created a JSFiddle. If I simply add the attribute dir="rtl", ...

Move the chrome to the side of the window using Python and Selenium

I'm currently working with Python Selenium to launch Chrome. I want Chrome to be positioned on the side as shown in the image below. Is there a simple method to achieve this? https://i.sstatic.net/jLSt5.jpg ...

Could not locate the CSS file within the HTML document (404)

I've searched high and low on YouTube but can't seem to find a solution to this problem. Every time I run the code, it gives me an error message saying GET net::ERR_ABORTED 404 (NOT FOUND) <html> <head> <title>itays websit ...

Create a smooth horizontal scroll effect for the text inside a div using jQuery and CSS, resembling a news ticker, without

Looking for suggestions on creating a horizontal scrolling effect within a div that mimics a "news ticker," but without relying on a plugin. The goal is to make the text move from right to left dynamically. Here's an example of the desired outcome usi ...

Align checkboxes horizontally to resemble a progress bar styling

Currently, I have a series of checkboxes that are displayed sequentially on the page. <div class="myCheck"> <h5>Here's what you've selected so far</h5> <label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect ...

What is the best method to remove the gap between my two horizontal div elements?

Is there a way to eliminate the small space between my two horizontal sections here? I've already attempted using margin: 0px; and padding: 0px; on the container, but it doesn't seem to be effective. Any assistance would be greatly appreciated! ...