Home >Web Front-end >HTML Tutorial >WeChat press and hold to speak HTML implementation_html/css_WEB-ITnose

WeChat press and hold to speak HTML implementation_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:44:281297browse

It’s faster to look at the code directly:


<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /><button id="hhhh">按住说话</button>  <style type="text/css">      #hhhh{height:40px;line-height: 40px; text-align: center; background: #f00; color:#fff;}  </style>  <script>  document.getElementById('hhhh').addEventListener('touchstart', function(ev) {           ev.preventDefault();           this.style.background = '#f00';           //your start record code here...        }, false);  document.getElementById('hhhh').addEventListener('touchend', function(ev) {          ev.preventDefault();           this.style.background  = '#0f0';           //your stop record code here...        }, false);</script>


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn