900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > html 一键复制 ios 兼容安卓和ios实现一键复制内容到剪切板

html 一键复制 ios 兼容安卓和ios实现一键复制内容到剪切板

时间:2019-08-09 06:47:00

相关推荐

html 一键复制  ios 兼容安卓和ios实现一键复制内容到剪切板

js兼容安卓和ios实现粘贴板一键复制

color: #000;

background: #fff;

overflow-y: scroll;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;

}

html*{

outline:0;-webkit-text-size-adjust: none;-webkit-tap-highlight-color: transparent

}*{

margin:0;

padding:0}

.content {78.7%;

height:11.093rem;

margin:0auto;

background: url('./xxxxxx.png');

background-size: 100% 100%;

margin-top: 20%;

}

.onebox{

height:8.907rem;

}

.midtext{

font-family: PingFangSC-Regular;

font-size: 12px;

color: #4FA3FF;

letter-spacing: 0;

text-align: left;66%;

padding-top: 8.0rem;

margin:0auto;

}

.bottbox{

text-align: center;

font-size: 0;

margin-top: 0.693rem;

}

.one-copy{3.467rem;

height:0.853rem;

}/*小弹窗*/#message{27%;

height:0.8rem;

line-height: 0.8rem;

bottom:50%;

font-size: 12px;

color: #fff;

z-index: 99;

box-shadow: 0 1px 14px rgba(0,0,0,.24);

opacity:0;

visibility: hidden;-webkit-transform: translateX(-50%);-ms-transform: translateX(-50%);

transform: translateX(-50%);

text-align: center;

border-radius: 0.8rem;

}

#message.show {

visibility: visible;

}

#message {

position:fixed;

background: rgba(0,0,0,.6);

left:50%;

}

#msgTxt{

line-height:1.55rem;

height:3.1rem;

}

.show {

display: block!important;

}

https://ahhahahahhahahah

//兼容安卓和ios实现剪切板复制的方法

function copy() {var message="https://ajskajskajskajskjaskajksjka";var input = document.createElement("input");

input.value=message;

document.body.appendChild(input);

input.select();

input.setSelectionRange(0, input.value.length), document.execCommand('Copy');

document.body.removeChild(input);//一键复制按钮变浅

document.querySelector("#one-copy").style.opacity='0.5';//复制成功提示

toast('复制成功');

}//弹窗组件

function toast(message) {vartimer;

document.querySelector("#message").style.opacity='1';

document.getElementById('mytext').innerHTML=message;

clearTimeout(timer);

timer= setTimeout( ()=>{

document.querySelector("#message").style.opacity='0';

},2000);

}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。