ripple.ts 701 字节
Newer Older
X
xjh22222228 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
import { annotate } from 'rough-notation'
import { queryString } from './index'

let ANNOTATE_EQUEUE = []

export function initRipple() {
  (<any>window).$.ripple('.ripple-btn', {
    multi: true,
    debug: false,
    opacity: .2,
  })
}

export function setAnnotate(querySelector = '.top-nav .ripple-btn') {
  const elList = document.querySelectorAll(querySelector) || []
  if (elList.length === 0) return

  ANNOTATE_EQUEUE.forEach(item => item.hide())
  ANNOTATE_EQUEUE = []
  const { page } = queryString()

  const annotation = annotate(elList[page], {
    type: 'underline',
X
xjh22222228 已提交
24
    color: '#f9826c',
X
xjh22222228 已提交
25 26 27 28 29 30
    padding: 3,
    strokeWidth: 3
  })
  ANNOTATE_EQUEUE.push(annotation)
  annotation.show()
}