ngx-basicscroll - Angular wrapper to basicScroll
View all the directives in action at https://theunreal.github.io/ngx-basicscroll
- Angular (requires Angular 2 or higher, tested with 2.0.0)
Install above dependencies via npm.
Now install ngx-basicscroll
via:
npm install --save basicscroll ngx-basicscroll
Note:If you are using
SystemJS
, you should adjust your configuration to point to the UMD bundle. In your systemjs config file,map
needs to tell the System loader where to look forngx-basicscroll
:
map: {
'ngx-basicscroll': 'node_modules/ngx-basicscroll/bundles/ngx-basicscroll.umd.js',
}
Once installed you need to import the main module:
import { BasicScrollModule } from 'ngx-basicscroll';
The only remaining part is to list the imported module in your application module. The exact method will be slightly
different for the root (top-level) module for which you should end up with the code similar to (notice BasicScrollModule .forRoot()
):
import { BasicScrollModule } from 'ngx-basicscroll';
@NgModule({
declarations: [AppComponent, ...],
imports: [BasicScrollModule.forRoot(), ...],
bootstrap: [AppComponent]
})
export class AppModule {
}
Other modules in your application can simply import BasicScrollModule
:
import { BasicScrollModule } from 'ngx-basicscroll';
@NgModule({
declarations: [OtherComponent, ...],
imports: [BasicScrollModule, ...],
})
export class OtherModule {
}
<bs-element [options]="bsOptions" class="box easeBox">1</bs-element>
{
from: 'middle-bottom',
to: 'bottom-top',
direct: true,
props: {
'--ty': {
from: '0',
to: '100px',
timing: 'circIn'
}
}
}
.box {
padding: 1em 2em;
margin: 0 .5em;
background: #ddd;
will-change: transform;
}
.easeBox { transform: translateY(var(--ty)); }
Copyright (c) 2018 Eliran Elnasi. Licensed under the MIT License (MIT)