1.1.1 • Published 13 days ago

js-minimap v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
13 days ago

js-minimap

中文文档

Generate a minimap for your web page(or a module), and observe the view to update automatic.

自动生成页面(或局部模块)的缩略图,并可观察视图变化以自动更新缩略图。

Demo

preview

Installation

NPM

import Minimap from 'js-minimap'

Browser

<script src="js-minimap/dist/minimap.umd.js" />

// cdn
<script src="https://cdn.jsdelivr.net/npm/js-minimap" />
// or
<script src="https://unpkg.com/js-minimap" />

Usage

<div class="container">
  <!-- your content -->
</div>
<div class="minimap"></div>
<script>
  const container = document.querySelector('.container') // any container you want to generate a minimap for
  const target = document.querySelector('.minimap') // the container of the minimap
  const minimap = new Minimap({
    container,
    target,
    width: 200,
    observe: true, // default true
    throttle: 30, // default 30
  })
</script>

Options

OptionDescriptionTypeDefault
containerany container you want to generate a minimap forHTMLElement-
targetsomewhere you want to place the minimap.HTMLElement-
widthminimap's widthnumber200
heightminimap's height, if width is available, height will be ignorednumber-
observewhether observe the view container to update the minimap, based on MutationObserverbooleantrue
throttlethrottle timenumber30

Methods

reset

if you want to reset the minimap manually, call reset method.

const minimap = new Minimap({
  container,
  target,
  observe: false,
})

// when you want to reset the minimap, for example, the container's content changed
minimap.reset()
1.1.1

13 days ago

1.1.0

13 days ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago