Skip to content

Instantly share code, notes, and snippets.

@ryanpcmcquen
Last active January 13, 2018 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ryanpcmcquen/1229119ffcf5098543c0 to your computer and use it in GitHub Desktop.
Save ryanpcmcquen/1229119ffcf5098543c0 to your computer and use it in GitHub Desktop.
invisibleCopyItemForSimpleJsCopy.js
/*global window*/
/*jslint browser: true*/
(function () {
"use strict";
window.addEventListener("load", function () {
var iPhoneORiPod = false;
var iPad = false;
var safari = false;
if (navigator.userAgent.match(/iPhone|iPod/i)) {
iPhoneORiPod = true;
} else if (navigator.userAgent.match(/iPad/i)) {
iPad = true;
} else if (/^((?!chrome).)*safari/i.test(navigator.userAgent)) {
safari = true;
}
var copyItem = document.querySelector(".text-to-copy");
if (iPhoneORiPod || iPad || safari) {
copyItem.style.opacity = 1;
copyItem.style.position = "relative";
}
});
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment