You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

32 lines
1.0 KiB

<!-- start Simple Custom CSS and JS -->
<script type="text/javascript">
jQuery(document).ready(function( $ ){
$(function() {
// copy content to clipboard
function copyToClipboard(element) {
var $temp = $("<input>");
$("body").append($temp);
$temp.val($(element).text()).select();
document.execCommand("copy");
$temp.remove();
}
// copy coupone code to clipboard
$(".coupon-btn").on("click", function() {
copyToClipboard("#coupon-field");
$(".coupon-alert").fadeIn("slow");
});
});
});
jQuery(function($){
$(document).mouseup( function(e){ // событие клика по веб-документу
var div = $( ".coupon-alert" ); // тут указываем ID элемента
if ( !div.is(e.target) // если клик был не по нашему блоку
&& div.has(e.target).length === 0 ) { // и не по его дочерним элементам
div.hide(); // скрываем его
}
});
});
</script>
<!-- end Simple Custom CSS and JS -->