我有一个包含韩语文本的网页,我希望这样做,以便在光标之后有一个圆形的剪贴蒙版,这样当剪贴蒙版位于韩文上方时,英文翻译就会显示在下方。到目前为止,我有一些代码,但是我不确定如何使整个事情正常进行。我该如何实现? here就是这种效果的一个例子,但是我不确定它们是如何得到效果的。 代码中也有错误,我不确定是什么。
代码:
jQuery(document).ready(function(){
$('.hero').mousemove(function(e){
var rXP = (e.pageX - this.offsetLeft-$(this).width()/2);
var rYP = (e.pageY - this.offsetTop-$(this).height()/2);
$('.hero').css('text-shadow', +rYP/10+'px '+rXP/80+'px rgba(227,6,19,.8), '+rYP/8+'px '+rXP/60+'px rgba(255,237,0,1), '+rXP/70+'px '+rYP/12+'px rgba(0,159,227,.7)');
});
$('.hiddenhero').mousemove(function(e){
var rXP = (e.pageX - this.offsetLeft-$(this).width()/2);
var rYP = (e.pageY - this.offsetTop-$(this).height()/2);
$('.hiddenhero').css('text-shadow', +rYP/10+'px '+rXP/80+'px rgba(227,6,19,.8), '+rYP/8+'px '+rXP/60+'px rgba(255,237,0,1), '+rXP/70+'px '+rYP/12+'px rgba(0,159,227,.7)');
});
});
window.onload = function(){
var bsDiv = document.getElementById("herocircle");
var x, y;
window.addEventListener('mousemove', function(event){
x = event.clientX;
y = event.clientY;
if ( typeof x !== 'undefined' ){
bsDiv.style.left = x + "px";
bsDiv.style.top = y + "px";
}
}, false);
}
@import url('https://fonts.googleapis.com/css?family=Black+Han+Sans');
html {
align-items: center;
background: #fcf8f2;
overflow-y: hidden;
overflow-x: hidden;
}
.herocontainer {
height: 1920px;
width: 1080px;
clip-path: url(#heroclip);
}
.hero {
color: black;
font-family: "Black Han Sans", sans-serif;
font-size: 100px;
transform: skew(-7deg, -7deg);
position: absolute;
text-align: center;
left: 40%;
top: 20%;
}
.herop {
display: inline-block;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>History</title>
<link href="main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<defs>
<svg>
<clipPath id="heroclip">
<circle cx="100" cy="100" r="125" stroke="transparent" stroke-width="3" fill="transparent"/>
</clipPath>
</svg>
</defs>
<div id="herocontainer">
<div class="hero">
<p class="herop">대한민국</p>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="script.js"></script>
</body>
</html>