Skip to content

Commit

Permalink
fixed email form ids in footer
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshvdw committed Mar 24, 2024
1 parent 27b924f commit 4e31018
Showing 1 changed file with 42 additions and 41 deletions.
83 changes: 42 additions & 41 deletions js/global/copyEmail.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,43 @@
export default copyEmail = () => {
function copyToClipboard(copyText) {
// copies text to keyboard by creating then deleting selectable text area
const el = document.createElement('textarea');
el.value = copyText;
document.body.appendChild(el);
el.select();
document.execCommand('copy');
document.body.removeChild(el);

// change text of header
$('.footer-title-roller-down').each(function() {
$(this).html('E-mail copied to clipboard');
})

// reset text of header after 1000 ms
setTimeout(function() {
$('.footer-title-roller-down').each(function() {
$(this).html('Copy email');
})
}, 1400);
};

var helloBlock = document.getElementById("email-block-hello");
helloBlock.addEventListener('click', function() {
copyToClipboard("[email protected]");
})

var remoteHelloBlock = document.getElementById("remote-hello");
remoteHelloBlock.addEventListener('click', function() {
copyToClipboard("[email protected]");
})
var careersBlock = document.getElementById("careers");
careersBlock.addEventListener('click', function() {
copyToClipboard("[email protected]");
})

var internBlock = document.getElementById("intern");
internBlock.addEventListener('click', function() {
copyToClipboard("[email protected]");
})
}
function copyToClipboard(copyText) {
// copies text to keyboard by creating then deleting selectable text area
const el = document.createElement("textarea");
el.value = copyText;
document.body.appendChild(el);
el.select();
document.execCommand("copy");
document.body.removeChild(el);

// change text of header
$(".footer-title-roller-down").each(function () {
$(this).html("E-mail copied to clipboard");
});

// reset text of header after 1000 ms
setTimeout(function () {
$(".footer-title-roller-down").each(function () {
$(this).html("Copy email");
});
}, 1400);
}

var remoteHelloBlock = document.getElementById("hello");
remoteHelloBlock.addEventListener("click", function () {
copyToClipboard("[email protected]");
});

var careersBlock = document.getElementById("careers");
careersBlock.addEventListener("click", function () {
copyToClipboard("[email protected]");
});

// var helloBlock = document.getElementById("email-block-hello");
// helloBlock.addEventListener('click', function() {
// copyToClipboard("[email protected]");
// })

// var internBlock = document.getElementById("intern");
// internBlock.addEventListener('click', function() {
// copyToClipboard("[email protected]");
// })
};

0 comments on commit 4e31018

Please sign in to comment.