1 Star 0 Fork 0

4betterus / watermark

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
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

空文件

简介

Create watermark for webpage and automatic adjust when window resize. 展开 收起
JavaScript
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/fbus/watermark.git
git@gitee.com:fbus/watermark.git
fbus
watermark
watermark
main

搜索帮助