New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@sygnas/scroll-amount

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sygnas/scroll-amount

Add scrolling state(top / not-top / bottom / not-bottom)

  • 1.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

syg-scroll-amount

Set data attribute according to status at the time of page scroll(top / not-top / bottom / not-bottom ..)

ページスクロール時にステータスに応じたdata属性を付与する(top / not-top / bottom / not-bottom ..)。

Description

スクロールに応じた固定ヘッダーの出し入れなどに使います。 ブラウザがページスクロールした時に、「ページ最上部にいる」「ページ最上部にいない」などのステータスのdata属性をエレメントに付与します。

Usage

Install

npm install --save @sygnas/scroll-amount

html / JS / css

<header class="js-scroll-amount scroll-amount">
    ...menu...
</header>
import ScrollAmount from '@sygnas/scroll-amount';

const target1 = new ScrollAmount('.js-scroll-amount', {
    // Options
});
.scroll-amount{
    transition: .2s;

    &[data-scroll-amount ~= "top"]{
        transform: translateY(-40px);
    }
}

Attributes

属性 data-scroll-amount にステータスが書き出されます。

<header class="js-scroll-amount scroll-amount" data-scroll-amount="top pin">
namecomment
topスクロール位置が最上部
not-topスクロール位置が最上部ではない
bottomスクロール位置が最下部
not-bottomスクロール位置が最下部ではない

Options

optiondefaultcomment
offset_top50スクロール位置がこの値より上ならページ最上部と判断
offset_bottom50スクロール位置がこの値より下ならページ最下部と判断
onTopfunction最上部にスクロールした時に実行
onNotTopfunction最上部から離れた時に実行
onBottomfunction最下部にスクロールした時に実行
onNotBottomfunction最下部から離れた時に実行

License

MIT

Keywords

FAQs

Package last updated on 03 Feb 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc