js弹窗同时复制并到微信

<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>  

<script src="https://cdn.jsdelivr.net/clipboard.js/1.5.12/clipboard.min.js"></script>   


image

 <div id="popLayer"></div>

  <div id="popBox" class="bjs">

    <div class="close">

        <a onclick="closeBox()">关闭</a>

    </div>

     <p class="wxhfz">微信号已为您复制成功</p>

      <p class="wxhm" id="target">微信号255552</p>

      <p class="djwx">点击进入微信,添加微信号</p>

        <p class="qwx" onclick="myFunction()">去微信</p>

     <p class="sdtjwz">若无法打开请手动扫码添加微信</p>

    <div class="content">

    <img src="微信二维码路径" />

    </div>

</div>


  <script>

    /*点击弹出按钮*/

    function popBox() {

        var popBox = document.getElementById("popBox");

        var popLayer = document.getElementById("popLayer");

        popBox.style.display = "block";

        popLayer.style.display = "block";

    };

 

    /*点击关闭按钮*/

    function closeBox() {

        var popBox = document.getElementById("popBox");

        var popLayer = document.getElementById("popLayer");

        popBox.style.display = "none";

        popLayer.style.display = "none";

    }

</script>

   <script>    

    $(document).ready(function(){         

        var clipboard = new Clipboard('#copy_btn');    

        clipboard.on('success', function(e) {            

            e.clearSelection();    

            console.log(e.clearSelection);    

        });    

    });    

</script>  

   <script>

     function myFunction() {

     locatUrl = "weixin://";

     if(/ipad|iphone|mac/i.test(navigator.userAgent)) {

        var ifr =document.createElement("iframe");

        ifr.src = locatUrl;

        ifr.style.display = "none";

        document.body.appendChild(ifr);

     }else{

        window.location.href = locatUrl;

     }

     }

  </script> 


微信扫码咨询
建站咨询
cache
Processed in 0.008407 Second.