
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
angular-contents
Advanced tools
Angular Table of Contents that follow you while you scroll down.
zurfyx.github.io/angular-contents
npm install angular-contents
import { ContentsModule } from 'angular-contents';
@NgModule({
imports: [
...
ContentsModule,
...
],
∅
<div class="columnify" contents>
<!-- Body -->
<div>
<div [contentsSection]="'section-one'">
<h1>Section One</h1>
...
</div>
<div [contentsSection]="'section-two'">
<h1>Section Two</h1>
...
</div>
<!-- Table of Contents -->
<div class="table-column">
<ul class="contents-table" contentsTable>
<li><a href="#section-one" contentsLink>Section One</a></li>
<li><a href="#section-two" contentsLink>Section Two</a></li>
</ul>
</div>
</div>
* class names can be freely renamed. Just make sure to adjust the CSS classes later accordingly.
Below are the styles that the Angular Contents demo page uses. Only the <-- must have
fields are required. Feel free to adjust the rest to your website style.
The snippet above displays the Angular Contents specific styles, you can find the full page styles here.
.contents-table {
// Do not use margin here. It will be overwritten.
position: absolute; // <-- must have.
padding: 2rem;
}
.contents-table.sticky {
position: fixed; // <-- must have.
top: 0; // <-- must have.
}
.contents-table {
list-style: none;
margin: 0;
}
.contents-table a {
border-radius: 4px;
display: block;
padding: 0.3rem 0.6rem;
color: #444;
text-decoration: none;
}
.contents-table a.active {
background-color: #000;
color: #fff;
}
.columnify > .table-column {
flex: 0 1 auto;
width: 220px;
}
// Columnify https://stackoverflow.com/a/47220287
.columnify {
display: flex;
}
.columnify > * {
flex: 1;
}
.columnify > *:not(:first-child) {
margin-left: 2rem;
}
By default, Angular Contents carries no animation. Feel free to choose a scrolling library of your choice.
The demo page uses ngx-page-scroll. Attaching it to Angular Contents is as simple as it follows.
Install the library
npm install ngx-page-scroll
Import the library into your Module
import { ContentsModule } from 'angular-contents';
import { NgxPageScrollModule } from 'ngx-page-scroll';
imports: [
...
ContentsModule,
NgxPageScrollModule,
...
],
Add functionality into your Component HTML
<ul class="contents-table" contentsTable>
<li><a href="#section-one" contentsLink pageScroll>Section One</a></li>
<li><a href="#section-two" contentsLink pageScroll>Section Two</a></li>
<li><a href="#section-three" contentsLink pageScroll>Section Three</a></li>
<li><a href="#section-four" contentsLink pageScroll>Section Four</a></li>
<li><a href="#section-five" contentsLink pageScroll>Section Five</a></li>
</ul>
Notice pageScroll
addition.
For further ngx-page-scroll configuration, such as scroll speed, you should check their own repository.
MIT © Gerard Rovira Sánchez
FAQs
Angular Table of Contents that follow you while you scroll down.
The npm package angular-contents receives a total of 109 weekly downloads. As such, angular-contents popularity was classified as not popular.
We found that angular-contents demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.