js添加水印(文字+图片水印效果)

     /**
         * 文字加图片水印效果
         * id 要加水印的区域
         * watermarkImg 水印为图片的图片url
         * watermarkText 水印文字
         */
        
      
   function watermarkWord(id,watermarkImg , watermarkText) {
            var screenHeight = window.screen.height
            var watermarkImg = watermarkImg ;
            var watermarkText =  watermarkText;
            
            if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/9./i) == "9.") {
                var step = 180 / 480 * screenHeight;
                for (var i = 0; i <= parseInt($("body").height() / step); i++) {
                    $(‘body‘).append(‘<div style="z-index:-999;width:100%;text-align:center;opacity:0.2;color:#000;position:absolute;top:‘ + step * (i) + ‘px;font-size:2em;transform:rotate(-30deg); -ms-transform:rotate(-30deg); -o-tranform:rotate(-30deg); -webkit-transform:rotate(-30deg); -moz-transform:rotate(-30deg);filter:progid:DXImageTransform.Microsoft.Alpha(opacity=10));">‘ + watermarkText + ‘<br /><img style="width:8em;" src="‘ + watermarkImg + ‘" /></div>‘);
                }
            } else {
                var step = 180 / 480 * screenHeight;
                for (var i = 0; i <= parseInt($("body").height() / step); i++) {
                    $(‘body‘).append(‘<div style="z-index:-999;width:100%;text-align:center;opacity:0.5;color:#000;position:absolute;top:‘ + step * (i) + ‘px;font-size:2em;transform:rotate(-30deg); -ms-transform:rotate(-30deg); -o-tranform:rotate(-30deg); -webkit-transform:rotate(-30deg); -moz-transform:rotate(-30deg);filter:progid:DXImageTransform.Microsoft.Alpha(opacity=10) progid:DXImageTransform.Microsoft.Matrix(sizingMethod=\‘auto expand\‘, M11=0.866025404, M12=0.5, M21=-0.5, M22=0.866025404);">‘ + watermarkText + ‘<br /><img  style="width:8em;" src="‘ + watermarkImg + ‘" /></div>‘);
                }
            }
        }

  

js添加水印(文字+图片水印效果)
   function watermarkWord(id,watermarkImg , watermarkText) {
            var screenHeight = window.screen.height
            var watermarkImg = watermarkImg ;
            var watermarkText =  watermarkText;
            
            if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/9./i) == "9.") {
                var step = 180 / 480 * screenHeight;
                for (var i = 0; i <= parseInt($("body").height() / step); i++) {
                    $(‘body‘).append(‘<div style="z-index:-999;width:100%;text-align:center;opacity:0.2;color:#000;position:absolute;top:‘ + step * (i) + ‘px;font-size:2em;transform:rotate(-30deg); -ms-transform:rotate(-30deg); -o-tranform:rotate(-30deg); -webkit-transform:rotate(-30deg); -moz-transform:rotate(-30deg);filter:progid:DXImageTransform.Microsoft.Alpha(opacity=10));">‘ + watermarkText + ‘<br /><img style="width:8em;" src="‘ + watermarkImg + ‘" /></div>‘);
                }
            } else {
                var step = 180 / 480 * screenHeight;
                for (var i = 0; i <= parseInt($("body").height() / step); i++) {
                    $(‘body‘).append(‘<div style="z-index:-999;width:100%;text-align:center;opacity:0.5;color:#000;position:absolute;top:‘ + step * (i) + ‘px;font-size:2em;transform:rotate(-30deg); -ms-transform:rotate(-30deg); -o-tranform:rotate(-30deg); -webkit-transform:rotate(-30deg); -moz-transform:rotate(-30deg);filter:progid:DXImageTransform.Microsoft.Alpha(opacity=10) progid:DXImageTransform.Microsoft.Matrix(sizingMethod=\‘auto expand\‘, M11=0.866025404, M12=0.5, M21=-0.5, M22=0.866025404);">‘ + watermarkText + ‘<br /><img  style="width:8em;" src="‘ + watermarkImg + ‘" /></div>‘);
                }
            }
        }
View Code

 

js添加水印(文字+图片水印效果)

上一篇:.net core三个生命周期


下一篇:2. 妈呀,Jackson原来是这样写JSON的