听雨

watermark.js 在浏览器中添加图片水印

<img src="img/1.jpg" class="watermark" />

<script src="../watermark.js"></script>

<script>

var load = false;

window.onload = function(){

if(!load) {

    wmark.init({

        "position": "top-right", //水印添加的位置

        "opacity": 50, 

        "className": "watermark", //默认配置 "watermark"

        "path": "img/water.png" //水印图片路径

});

load = true;

}

}

</script>


watermark.js下载:https://github.com/pa7/watermark.js

使用参考:https://brianium.github.io/watermarkjs/docs.html

评论