精品国产免费观看久久久_久久天天躁狠狠躁夜夜爽_无码人妻少妇久久中文字幕_狠狠做深爱婷婷久久综合一区

互聯網知識

精準傳達 ? 價值共享

洞悉互聯網前沿資訊,探尋網站營銷規律

查看其它板塊

狐靈科技分享一個輸入框的打字特效

作者:狐靈科技 | 2020-03-09 20:58 |點擊:

在逛其他人博客的時候發現的,在輸入框里打字有特效,就把這個特效扒了出來,鑒于今天有三個人都問了我這個效果怎么設置,故分享之。

下面是輸入框的打字特效的演示效果
狐靈科技分享一個輸入框的打字特效

首先加載一個js文件,js代碼如下

(function webpackUniversalModuleDefinition(root, factory) {
    if(typeof exports === 'object' && typeof module === 'object')
        module.exports = factory();
    else if(typeof define === 'function' && define.amd)
        define([], factory);
    else if(typeof exports === 'object')
        exports["POWERMODE"] = factory();
    else
        root["POWERMODE"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/     // The module cache
/******/     var installedModules = {};

/******/     // The require function
/******/     function __webpack_require__(moduleId) {

/******/         // Check if module is in cache
/******/         if(installedModules[moduleId])
/******/             return installedModules[moduleId].exports;

/******/         // Create a new module (and put it into the cache)
/******/         var module = installedModules[moduleId] = {
/******/             exports: {},
/******/             id: moduleId,
/******/             loaded: false
/******/         };

/******/         // Execute the module function
/******/         modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

/******/         // Flag the module as loaded
/******/         module.loaded = true;

/******/         // Return the exports of the module
/******/         return module.exports;
/******/     }


/******/     // expose the modules object (__webpack_modules__)
/******/     __webpack_require__.m = modules;

/******/     // expose the module cache
/******/     __webpack_require__.c = installedModules;

/******/     // __webpack_public_path__
/******/     __webpack_require__.p = "";

/******/     // Load entry module and return exports
/******/     return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {

    'use strict';

    var canvas = document.createElement('canvas');
    canvas.width = window.innerWidth;
    canvas.height = window.innerHeight;
    canvas.style.cssText = 'position:fixed;top:0;left:0;pointer-events:none;z-index:999999';
    window.addEventListener('resize', function () {
        canvas.width = window.innerWidth;
        canvas.height = window.innerHeight;
    });
    document.body.appendChild(canvas);
    var context = canvas.getContext('2d');
    var particles = [];
    var particlePointer = 0;
    var frames = 120;
    var framesRemain = frames;
    var rendering = false;
    POWERMODE.shake = true;

    function getRandom(min, max) {
        return Math.random() * (max - min) + min;
    }

    function getColor(el) {
        if (POWERMODE.colorful) {
            var u = getRandom(0, 360);
            return 'hsla(' + getRandom(u - 10, u + 10) + ', 100%, ' + getRandom(50, 80) + '%, ' + 1 + ')';
        } else {
            return window.getComputedStyle(el).color;
        }
    }

    function getCaret() {
        var el = document.activeElement;
        var bcr;
        if (el.tagName === 'TEXTAREA' ||
            (el.tagName === 'INPUT' && el.getAttribute('type') === 'text')) {
            var offset = __webpack_require__(1)(el, el.selectionStart);
            bcr = el.getBoundingClientRect();
            return {
                x: offset.left + bcr.left,
                y: offset.top + bcr.top,
                color: getColor(el)
            };
        }
        var selection = window.getSelection();
        if (selection.rangeCount) {
            var range = selection.getRangeAt(0);
            var startNode = range.startContainer;
            if (startNode.nodeType === document.TEXT_NODE) {
                startNode = startNode.parentNode;
            }
            bcr = range.getBoundingClientRect();
            return {
                x: bcr.left,
                y: bcr.top,
                color: getColor(startNode)
            };
        }
        return { x: 0, y: 0, color: 'transparent' };
    }

    function createParticle(x, y, color) {
        return {
            x: x,
            y: y,
            alpha: 1,
            color: color,
            velocity: {
                x: -1 + Math.random() * 2,
                y: -3.5 + Math.random() * 2
            }
        };
    }

    function POWERMODE() {
        { // spawn particles
            var caret = getCaret();
            var numParticles = 5 + Math.round(Math.random() * 10);
            while (numParticles--) {
                particles[particlePointer] = createParticle(caret.x, caret.y, caret.color);
                particlePointer = (particlePointer + 1) % 500;
            }
            framesRemain = frames;
            if (!rendering) {
                requestAnimationFrame(loop);
            }
        }
        { // shake screen
            if (POWERMODE.shake) {
                var intensity = 1 + 2 * Math.random();
                var x = intensity * (Math.random() > 0.5 ? -1 : 1);
                var y = intensity * (Math.random() > 0.5 ? -1 : 1);
                document.body.style.marginLeft = x + 'px';
                document.body.style.marginTop = y + 'px';
                setTimeout(function() {
                    document.body.style.marginLeft = '';
                    document.body.style.marginTop = '';
                }, 75);
            }
        }
    };
    POWERMODE.colorful = false;

    function loop() {
        if (framesRemain > 0) {
            requestAnimationFrame(loop);
            framesRemain--;
            rendering = true;
        } else {
            rendering = false;
        }
        
        context.clearRect(0, 0, canvas.width, canvas.height);
        for (var i = 0; i < particles.length; ++i) {
            var particle = particles[i];
            if (particle.alpha <= 0.1) continue;
            particle.velocity.y += 0.075;
            particle.x += particle.velocity.x;
            particle.y += particle.velocity.y;
            particle.alpha *= 0.96;
            context.globalAlpha = particle.alpha;
            context.fillStyle = particle.color;
            context.fillRect(
                Math.round(particle.x - 1.5),
                Math.round(particle.y - 1.5),
                3, 3
            );
        }
    }
    requestAnimationFrame(loop);

    module.exports = POWERMODE;


/***/ },
/* 1 */
/***/ function(module, exports) {

    /* jshint browser: true */

    (function () {

    // The properties that we copy into a mirrored div.
    // Note that some browsers, such as Firefox,
    // do not concatenate properties, i.e. padding-top, bottom etc. -> padding,
    // so we have to do every single property specifically.
    var properties = [
      'direction',  // RTL support
      'boxSizing',
      'width',  // on Chrome and IE, exclude the scrollbar, so the mirror div wraps exactly as the textarea does
      'height',
      'overflowX',
      'overflowY',  // copy the scrollbar for IE

      'borderTopWidth',
      'borderRightWidth',
      'borderBottomWidth',
      'borderLeftWidth',
      'borderStyle',

      'paddingTop',
      'paddingRight',
      'paddingBottom',
      'paddingLeft',

      // https://developer.mozilla.org/en-US/docs/Web/CSS/font
      'fontStyle',
      'fontVariant',
      'fontWeight',
      'fontStretch',
      'fontSize',
      'fontSizeAdjust',
      'lineHeight',
      'fontFamily',

      'textAlign',
      'textTransform',
      'textIndent',
      'textDecoration',  // might not make a difference, but better be safe

      'letterSpacing',
      'wordSpacing',

      'tabSize',
      'MozTabSize'

    ];

    var isFirefox = window.mozInnerScreenX != null;

    function getCaretCoordinates(element, position, options) {

      var debug = options && options.debug || false;
      if (debug) {
        var el = document.querySelector('#input-textarea-caret-position-mirror-div');
        if ( el ) { el.parentNode.removeChild(el); }
      }

      // mirrored div
      var div = document.createElement('div');
      div.id = 'input-textarea-caret-position-mirror-div';
      document.body.appendChild(div);

      var style = div.style;
      var computed = window.getComputedStyle? getComputedStyle(element) : element.currentStyle;  // currentStyle for IE < 9

      // default textarea styles
      style.whiteSpace = 'pre-wrap';
      if (element.nodeName !== 'INPUT')
        style.wordWrap = 'break-word';  // only for textarea-s

      // position off-screen
      style.position = 'absolute';  // required to return coordinates properly
      if (!debug)
        style.visibility = 'hidden';  // not 'display: none' because we want rendering

      // transfer the element's properties to the div
      properties.forEach(function (prop) {
        style[prop] = computed[prop];
      });

      if (isFirefox) {
        // Firefox lies about the overflow property for textareas: https://bugzilla.mozilla.org/show_bug.cgi?id=984275
        if (element.scrollHeight > parseInt(computed.height))
          style.overflowY = 'scroll';
      } else {
        style.overflow = 'hidden';  // for Chrome to not render a scrollbar; IE keeps overflowY = 'scroll'
      }

      div.textContent = element.value.substring(0, position);
      // the second special handling for input type="text" vs textarea: spaces need to be replaced with non-breaking spaces - http://stackoverflow.com/a/13402035/1269037
      if (element.nodeName === 'INPUT')
        div.textContent = div.textContent.replace(/\s/g, "\u00a0");

      var span = document.createElement('span');
      // Wrapping must be replicated *exactly*, including when a long word gets
      // onto the next line, with whitespace at the end of the line before (#7).
      // The  *only* reliable way to do that is to copy the *entire* rest of the
      // textarea's content into the <span> created at the caret position.
      // for inputs, just '.' would be enough, but why bother?
      span.textContent = element.value.substring(position) || '.';  // || because a completely empty faux span doesn't render at all
      div.appendChild(span);

      var coordinates = {
        top: span.offsetTop + parseInt(computed['borderTopWidth']),
        left: span.offsetLeft + parseInt(computed['borderLeftWidth'])
      };

      if (debug) {
        span.style.backgroundColor = '#aaa';
      } else {
        document.body.removeChild(div);
      }

      return coordinates;
    }

    if (typeof module != "undefined" && typeof module.exports != "undefined") {
      module.exports = getCaretCoordinates;
    } else {
      window.getCaretCoordinates = getCaretCoordinates;
    }

    }());

/***/ }
/******/ ])
});
;
JavaScript

然后在加入下面的代碼即可

<script>
POWERMODE.colorful = true; // make power mode colorful
POWERMODE.shake = false; // turn off shake
document.body.addEventListener('input', POWERMODE);
</script>
如沒特殊注明,文章均為狐靈科技原創,轉載請注明?? "狐靈科技分享一個輸入框的打字特效
多一份免費策劃方案,總有益處。

請直接添加技術總監微信聯系咨詢

網站設計 品牌營銷

多一份參考,總有益處

聯系狐靈科技,免費獲得專屬《策劃方案》及報價

咨詢相關問題或預約面談,可以通過以下方式與我們聯系

業務熱線:15082661954 / 大客戶專線:15523356218

少妇自慰喷AV免费网站| 宝贝把腿开大让我添添电影 | 久久久久人妻一区二区三区| 中文字幕丰满乱子伦无码专区| 天堂АⅤ在线最新版在线| 人妻系列无码专区久久五月天| 亚洲成人无码av| 无码专区国产精品第一页| JIZZJIZZJIZZ日本| 屠户家的小娇花哒哒啦爱你| 乳揉みま痴汉电车中文字幕| 精品国产乱码久久久久久下载| 久久精品国产精品亚洲下载| 久久人人爽人人爽人人片AV麻烦| YSL千人千色T9T9T9T9| 中国 韩国 日本 免费看| 粉嫩AV一区二区三区| 久久AV伊人蜜臀一区二区| 国产成人亚洲综合A∨| 激情内射人妻1区2区3区| 中文无码人妻丰满熟妇啪啪| 日韩免费高清大片在线| 高清一区二区三区免费视频| 脔到她哭H粗话H好爽五星视频| 熟妇高潮一区二区精品视频| 50岁丰满女人裸体毛茸茸| 成人一区二区不卡久久久| 国产专区一线二线三线品牌东| 人人爽人人片人人片AV| 中国老妇XXXX性开放| 国产成人精品一区二区三区无码| 久久精品亚洲精品无码| 亚洲国产成人AⅤ毛片奶水| 国精产品一二伊田园9777| 亚洲А∨天堂久久精品2021 | 撕掉她的衣服吮的双乳游戏| 久久国产欧美日韩精品| 欧美人与禽XOXO牲伦交| 自拍偷在线精品自拍偷无码专区| 好姐妹高清在线韩国电影观看| 国产精品久久久久久久稀缺资源 | 欧美精品亚洲精品日韩专区VA | 国产肉体XXXX裸体784大胆| 天堂√最新版中文在线| 好男人在线视频神马影视WWW| 色综合色综合久久综合频道88 | 越南少妇毛茸茸的大BBW| 丰满岳乱妇在线观看中字| 黑人粗大猛烈进出高潮视频| 国内精品乱码卡一卡2卡三卡新区| 国产在线无码免费网站永久| 少妇呻吟喷水视频正在播放| 把腿张开老子臊烂你的漫画| 国产AV无码专区亚洲AⅤ| 久久久无码中文字幕久| 亚洲丰满熟妇浓毛XXXX| 青草青草视频2免费观看| 丰满少妇人妻HD高清大乳在线 | 国产精品免费AⅤ片在线观看| 亚洲AⅤ无码日韩AV中文AV伦| 国产乱人伦偷精品视频免观看| 色狠狠色噜噜AV天堂一区| 亚洲综合大片6999| 久久精品人人槡人妻人人玩AV | 亚洲国产AⅤ精品一区二区蜜桃| ZOZOTOWN| 国产成人久久综合第一区| 韩国三级在线观看完整版| 前夫6天要了我25次| 白丝制服被啪到喷水很黄很暴力| 色欲AⅤ蜜臀AV在线播放| 色情ⅩXXX欧美色妇HD| 99精品国产在热久久| 蜜桃AV无码免费看永久| 中文字幕一区二区三区乱码视频| 日韩国产欧美亚洲V片| 非洲BBOOMBBOOM的含义| 国内精品久久久久久久久齐齐| 女儿男朋友是妈妈的爱豆的电视剧| 99精产国品一二三产区MBA| 麻豆蜜桃AV蜜臀AV色欲AV| 白嫩少妇激情无码| 亚洲国产区男人本色| 末成年女AV片一区二区| 国产在线看片无码不卡| 亚洲一区二区三区丝袜| 人妻少妇一级毛片内射一牛影视| 中文字幕理伦午夜福利片| 久久国产劲爆∧V内射-百度| 无码视频免费一区二三区| 国产成人片AⅤ在线观看| 涩爱亚洲色欲AV无码成人专区| 波多野结衣一二三区AV高清| 欧美丰满少妇人妻精品| 亚州中文字幕午夜福利电影| 99久在线国内在线播放免费观看| 麻花传媒剧在线MV免费观看| 成人免费无码大片A毛片抽搐色欲 成人免费无码大片A毛片抽搐 | 亚洲AV成人在线播放| 亚洲成AV人在线视达达兔| 国产一区二区三区在线视頻| 亚洲AV羞羞无码高潮喷水好爽| 国产亚洲欧美精品久久久| 亚洲精品乱码久久久久久蜜桃图片 | 中文字幕日韩欧美一区二区三区 | 久久国产成人午夜AV影院| 亚洲AV中文无码字幕色最| 国产午夜成人无码免费看| 性色欲情网站IWWW| 护士被强女千到高潮视频| 自拍亚洲欧美在线成电影| 和人妻隔着帘子按摩中字| 色噜噜狠狠色综合久色AⅤ网| 吃奶呻吟打开双腿做受视频| 色综合色综合久久综合频道88| 久久久97精品国产一区蜜桃| 大胆极品美軳人人体| 色欲色欲天天天WWW亚洲伊| 国产GAYSEXCHINA男外| 野花韩国高清免费神马百度| 久久亚洲精品无码AV大香| 色婷婷综合中文久久一本| 精产国品一二三产品区别大吗| 99尹人香蕉国产免费天天| 无码精品人妻一区二区三区影院| 欧美性色黄大片手机版| 久久综合激激的五月天| 精品久久久无码中字| 国产偷国产偷亚洲清高APP| 粗大从后面狠狠贯穿H| 在线 | 麻豆国产传媒| 搡BBB搡BBBB搡BBBB| 含羞草传媒免费进入APP老版本| 亚洲AV成人无码影视网| 日本免费黄色网址| 国内美女推油按摩在线播放 | 成·人免费午夜无码区| 蜜臀久久久久精品久久久| 波多野无码中文字幕AV专区| 亚洲精品成人网久久久久久| 能让我流水水的一千字| 国产精品门事件AV| 国产成人精品三级在线影院| 国产强伦姧在线观看无码| 国产强被迫伦姧在线观看无码| 国产乱子伦农村叉叉叉| 成人无码区免费AⅤ片WWW| 厨房里我扒了岳的内裤| AV无码欧洲亚洲电影网| 亚洲精品无码成人片久久不卡| 四虎成人永久在线精品免费| 国产无套中出学生姝| 国产成人A在线观看视频免费| 真实的国产乱XXXX在线| 性一交一乱一伦一在线小视频| 十八禁乳露裸体奶头WWW网站| 久久精品无码一区二区WWW| WWW.国产白丝袜护士喷白浆| 亚洲爆乳精品无码一区二区三区| 人妻 日韩精品 中文字幕| 日本黄漫动漫在线观看视频| 日日摸夜夜添夜夜添亚洲女人| 娇小美女被黑壮汉C到喷水 | 女神被啪进深处娇喘在线观看| 久久婷婷人人澡人人爽人人喊| 国产精品无码久久久久| 亚洲va熟妇自拍无码区| 农村人乱弄一区二区| 精品熟女少妇A∨免费久久| 国产精品成人久久久久久久| CHINA末成年VIDEOS| 国产VA在线观看免费| 护士的色诱2在线观看免费| 免费视频片多多视频免费高清| 日韩一区二区三区无码影院| 天天夜碰日日摸日日澡性色AV | 亚洲国产另类久久久精品| 天美传媒国色天香乱码| 女生会把隐私透露给异性朋友 | 亚洲大色堂人在线无码| 欧美丰满熟妇乱XXXXX视频| 娇妻在卧室里被领导爽电影| 东北妇女精品BBWBBW| 97久久香蕉国产线看观看| 亚洲AV永久无码精品无码电影| 色综合久久久久无码专区| 精品亚洲自慰AV无码喷奶水| 精品人妻少妇一区二区三区在线| 九色综合狠狠综合久久| 久久久久久人妻精品一区二区三区 | 高清欧美性猛XXXX黑人| 99久久99久久久精品齐齐综合| 中文字幕熟妇人妻在线视频| 亚洲免费福利视频| 亚洲乱码一区二区三区在线观看| 无码福利日韩神码福利片| 日韩欧洲在线高清一区| 色欲AV蜜臀AV一区在线| 四虎成人精品无码| 亚洲精品国产情侣AV在线|