Focus management of smooth scrolling
How do I make an focus management of smooth scrolling?
What is a focus management of smooth scrolling? How do you make a focus management of smooth scrolling? This script and codes were developed by Heydon on 27 August 2022, Saturday.
Focus management of smooth scrolling - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Focus management of smooth scrolling</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <nav role="navigation"> <ul> <li><a href="#section1">Section 1</a></li> <li><a href="#section2">Section 2</a></li> <li><a href="#section3">Section 3</a></li> </ul>
</nav>
<section id="section1"> <h2>Section 1</h2> <p>Donec tempus tempus tellus, ac lacinia turpis mattis ac. Nulla vel magna sit amet dui lobortis commodo vitae vel nulla sit amet ante hendrerit tempus. Sed dapibus, lectus sit amet adipiscing egestas, mauris est viverra nibh. Donec tempus tempus tellus, ac lacinia turpis mattis ac. Nulla vel magna sit amet dui lobortis commodo vitae vel nulla sit amet ante hendrerit tempus. Sed dapibus, lectus sit amet adipiscing egestas, mauris est viverra nibh. Donec tempus tempus tellus, ac lacinia turpis mattis ac. Nulla vel magna sit amet dui lobortis commodo vitae vel nulla sit amet ante hendrerit tempus. Sed dapibus, lectus sit amet adipiscing egestas, mauris est viverra nibh.</p>
</section>
<section id="section2"> <h2>Section 2</h2> <p>Maecenas sit amet tellus – nec mi gravida posuere non <a href="#">pretium magna</a>. Potenti et eros sed justo commodo bibendum non at nunc. Suspendisse potenti cras molestie, risus a enim convallis vitae luctus libero lacinia. Donec tempus tempus tellus, ac lacinia turpis mattis ac. Nulla vel magna sit amet dui lobortis commodo vitae vel nulla sit amet ante hendrerit tempus. Sed dapibus, lectus sit amet adipiscing egestas, mauris est viverra nibh. Donec tempus tempus tellus, ac lacinia turpis mattis ac. Nulla vel magna sit amet dui lobortis commodo vitae vel nulla sit amet ante hendrerit tempus. Sed dapibus, lectus sit amet adipiscing egestas, mauris est viverra nibh. Donec tempus tempus tellus, ac lacinia turpis mattis ac. Nulla vel magna sit amet dui lobortis commodo vitae vel nulla sit amet ante hendrerit tempus. Sed dapibus, lectus sit amet adipiscing egestas, mauris est viverra nibh.</p>
</section>
<section id="section3"> <h2>Section 3</h2> <p>Donec a congue leo. Suspendisse potenti cras molestie, risus a enim convallis vitae luctus libero lacinia. Nunc iaculis risus vel orci ornare dignissim sed vitae nulla.</p>
</section> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Focus management of smooth scrolling - Script Codes CSS Codes
body { max-width: 30em; padding: 1.5em 0; margin: 0 auto; font-size: 150%;
}
nav li { display: inline; padding-right: 1em;
}
ul { margin: 0; padding: 0;
}
a { color: blue;
}
Focus management of smooth scrolling - Script Codes JS Codes
/* Basics lifted from a CSS Tricks demo (http://css-tricks.com/snippets/jquery/smooth-scrolling/), with focus() and URL hash updating added where commented */
$(function() { /* ADDED: make sections focusable */ $('section[id]').attr('tabindex', '-1'); /* end ADDED */ $('a[href*=#]:not([href=#])').on('click', function(e) { var $linkElem = $(this); if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { e.preventDefault(); var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html,body').animate({ scrollTop: target.offset().top }, 1000, function() { target.focus(); window.location.hash = $linkElem.attr('href').substring(1); }); } } });
});

Developer | Heydon |
Username | heydon |
Uploaded | August 27, 2022 |
Rating | 3 |
Size | 2,506 Kb |
Views | 40,460 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Ransom Note With Google Font Subsets | 2,217 Kb |
Invert custom properties | 2,026 Kb |
DIV wormhole | 1,932 Kb |
CSS only, automated, and accessible external link icon | 1,678 Kb |
Theme color inverter with filter | 0 Kb |
4 columns with padding | 1,576 Kb |
Vue.js TODO List | 4,218 Kb |
Redesigned gender form field | 1,160 Kb |
Current Page Test Case | 1,827 Kb |
Accessible, pretty radio controls | 2,112 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Slide out Menu | Rbiggs | 4,936 Kb |
Sequence.js - Sliding Horizontal Parallax | Maheshc | 4,537 Kb |
Count up | Alanshortis | 2,391 Kb |
Angular-HAML | Cwacht | 2,022 Kb |
Responsive Menu I | Rodericksandoval | 3,045 Kb |
TestTube CSS | EZPK | 2,710 Kb |
FreeCodeCamp - Simon Game | Ivhed | 8,481 Kb |
Hc first draft | Stepfray | 5,104 Kb |
Simple search using AngularJS | Haykou | 1,802 Kb |
Login with flip 3d animation | Mariusbalaj | 3,014 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!