//テキストコピー function copy(id) { var copyText = document.getElementById(id); var ua = navigator.userAgent; if (ua.match(/iphone|ipod|ipad|android/i)) { try { copyText.select(); } catch (error) {} var range = document.createRange(); range.selectNode(copyText); window.getSelection().addRange(range); } else { try { copyText.select(); // input field } catch (error) { document.getSelection().selectAllChildren(copyText); } } $(this).children("span").addClass("cpanime"); var result = document.execCommand("copy"); //選択範囲の解除 if (window.getSelection) { window.getSelection().removeAllRanges(); } //入力中のテキストボックスの選択解除 var activeEl = document.activeElement; if (activeEl) { var tagName = activeEl.nodeName.toLowerCase(); if ( tagName == "textarea" || (tagName == "input" && activeEl.type == "text") ) { // Collapse the selection to the end activeEl.selectionStart = activeEl.selectionEnd; } } return result } // function copyButton(elementId) { // // 引数で得たIDの要素のテキストを取得 // var element = document.getElementById(elementId); // // 上記要素をクリップボードにコピーする // navigator.clipboard.writeText(element.textContent); // $(this).children("span").addClass("cpanime"); // } $(function() { $(".copy_text").click(function(){ $(this).children('span').addClass('cpanime'); setTimeout(function(){ $(".copy_text").children('span').removeClass('cpanime'); },2000); }); //モーダル関連 $(".inline").colorbox({ inline:true, maxWidth:"90%", maxHeight:"90%", opacity: 0.7, }); $("#btn_close").click(function(){ $("#cboxOverlay").trigger("click"); return false; }); });