1 Star 0 Fork 0

4betterus / watermark

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
README.md 2.77 KB
一键复制 编辑 原始数据 按行查看 历史
Cell 提交于 2022-02-19 22:01 . :memo:Docs: update README

Usage

Browser

  1. Clone source

    git clone git@github.com:Lruihao/watermark.git
  2. Load Watermark

    <script type="text/javascript" src="./src/watermark.js"></script>
    <script type="text/javascript" src="./src/watermark.min.js"></script>
    <!-- Or CDN -->
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/cell-watermark@1.0.3/src/watermark.js"></script>
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/cell-watermark@1.0.3/src/watermark.min.js"></script>
  3. Initialization

    document.addEventListener('DOMContentLoaded', function () {
      new Watermark({
        content: "cell-watermark"
      })
    });

NPM

  1. Install

    npm i cell-watermark
  2. Import

    import Watermark from 'cell-watermark'
    /* Or */
    var Watermark = require("cell-watermark")

Class: Watermark

Watermark(options)

new Watermark(options)

Parameters:
Name Type Description
options Object The options of watermark(Properties
Properties:
Name Type Attributes Default Description
content String <optional> watermark's text
appendTo String <optional> 'body' parent of watermark's container
width Number <optional> 150 watermark's width. unit: px
height Number <optional> 20 watermark's height. unit: px
rowSpacing Number <optional> 60 row spacing of watermarks. unit: px
colSpacing Number <optional> 30 col spacing of watermarks. unit: px
rotate Number <optional> 15 watermark's tangent angle. unit: deg
opacity Number <optional> 0.1 watermark's transparency
fontSize Number <optional> 0.85 watermark's fontSize. unit: rem
fontFamily String <optional> 'inherit' watermark's fontFamily

Author: Lruihao

Methods

upload(content)

Upload watermark's text content

Parameters:
Name Type Description
content String watermark's text

render(options)

Rerender watermark

Parameters:
Name Type Description
options Object The options of watermark(Properties

destroy()

Force destroy watermark

JavaScript
1
https://gitee.com/fbus/watermark.git
git@gitee.com:fbus/watermark.git
fbus
watermark
watermark
main

搜索帮助