0.1.9 • Published 5 years ago

watermark-div v0.1.9

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

demo

https://liugq5713.github.io/watermarkToDiv/

Features

  1. Using a text to stamp
  2. you can rotate the stamp in any rotate
  3. add watermark to any html elements,so you can add different watermarks in a web page

Defact

  1. watermark will set the position of the element for relative which contain the watermark
  2. when you set abnormal options of the wartemark like font:'226px serif',rotate:13/24*Math.PI.the watermark will only show a part of it and you could fix the issue by set yOffset which control the start point of the text.

Download

Git

git@github.com:Liugq5713/watermarkToDiv.git

npm

npm install --dev-save watermark-div

How to use

Usage

import Watermark from 'watermark-div'

const OPTIONS = { text: 'Hello World' }
const watermark = new Watermark(OPTIONS)
// contain_el is the container which you want to add watermark
watermark.embed(contain_el)

Options

NameTypeDefaultDescription
textString'Hello world'the text as watermark
fontString'16px serif'Font size and the style of text
opacityNumber0.6the opactity of watermark
densitynumber1the density of watermark
rotaterad-1 / 6 * Math.PIthe rotate of watermark
z_indexnumber2018the element's z-index which has watermark
colorString'rgba(151,168,190,0.6)'Text color, you can use HEX or RGBA color codes
yOffsetnumber3control the start point of text
0.1.9

5 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago