Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@ewtd/ewt-anchor

Package Overview
Dependencies
Maintainers
10
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ewtd/ewt-anchor

锚点双向滚动定位

latest
npmnpm
Version
0.1.3
Version published
Maintainers
10
Created
Source

USAGE

Install

$ npm i @ewtd/ewt

demo

import { Anchor } from '@ewtd/ewt';

const dataSource: [
  {
    title: 'string',
    element: document.getElementById('title'),
  },
  {
    title: <div>element</div>,
    element: this.refs.element,
  },
],

<Anchor
  style={{
    position: 'relative',
    right: 0,
    top: 0,
  }}
  dataSource={dataSource}
  active={0}
  initTop={0}
/>

API

参数说明类型默认值
dataSource锚点列表array[{title: string / element, element: document.getElementById('##') / ref}]
style自定义样式object{position: 'fixed',top: 0,right: 0,width: '120px'}
active初始化滚动位置number0
scrollStatescrollIntoView滚动的配置参数object{{behavior: 'smooth',block: 'start'}}
throttle节流毫秒数number500
timeoutscrollIntoView过程与滚动监听的间隔number1000
initTop容器相对于窗口的距离(滚动计算是相对于window)number0

Keywords

react

FAQs

Package last updated on 27 Aug 2020

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