
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
angular-smooth-scrollbar
Advanced tools
An angular module that helps you to customize high performance scrollbar.
bower install angular-smooth-scrollbar --save
http://idiotwu.github.io/angular-smooth-scrollbar/
As is explained in this article, browser repaint every frame in scrolling. Less painting is better.
To avoid repainting, I use translate3d
in scroll content to create composite layers and force hardware accelerating.
Include the script and stylesheet in your page file:
<link rel="stylesheet" href="bower_components/angular-smooth-scrollbar/dist/smooth-scrollbar.css">
<script src="bower_components/angular-smooth-scrollbar/dist/smooth-scrollbar.js"></script>
Add SmoothScrollbar
as dependency to your angular app:
angular.module('myApp', ['SmoothScrollbar']);
Use it wherever you want:
<section scrollbar="scrollbarName">
...
</section>
scrollbar
attribute, determine the name for this scrollbar instance.1
.100
.1000
.timing-function
or pre-defined curves here, default is cubic-bezier(0.1, 0.57, 0.1, 1)
.You can access your scrollbar instances through ScrollbarService
.
Get scrollbar instance by giving the name, and instance is passed through callback function. If the named instance is already existed, callback will be invoked as soon as possible, otherwise callback will not be called until that instance is create.
Remove all event listeners on the named instance, but will not remove scrollbar from DOM.
Scrollbar instance has exposed some methods so that you can controll the scrollbar.
Return the size of scrollbar container and scroll content, it may be something like this:
{
container: {
width: 600,
height: 400
},
content: {
width: 1000,
height: 3000
}
}
Update the scrollbar right now. This will be useful when you modified scroll content.
If you don't do this manually, scrollbar will be updated everytime you start scrolling (a rest(100ms) after continuous scrolling will terminate current scroll action, and when you start scrolling again, update
will be called).
This method behaves like DOM method element.scrollTo
, scroll content will be set to the given position without transition.
When you want to scroll content to position with easing animation, use this method.
Register scrolling listener to scrollbar instance, callback will be invoked in every small scrolling.
Be careful not to add time consuming listeners that will slow down scrolling.
Remove the given listener from listeners list.
This is another useful method when you want to make infinite scrolling. Callback will be invoked the first time you scroll to given threshold, then when you scrolling over threshold again. Default threshold is 50(px).
Smooth scrollbar will calculate you touch moving speed, and scroll to a distance of speed * easingDuration
more when you stop. This algorithm is not same as what the inertial scrolling is in mobile devices.
I've tried using uniformly accelerated motion, but it worked so bad that i have to use cubic-bezier
easing. If any one has an idea about this, please create an issue or make a pull request, thx.
FAQs
An angular module that allows you customize smooth scrollbars
We found that angular-smooth-scrollbar 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.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.