【发布时间】:2019-12-23 06:50:09
【问题描述】:
我的 WordPress 网站有一个可点击的两部分背景壁纸。它工作得很好,除了一件事:当鼠标悬停在背景上时,它仍然是一个箭头而不是手指指针,所以读者不知道它是可点击的。
我在脚本部分尝试了各种方法,但无济于事。当我让手指指针出现在背景上时,它也会出现在您碰巧悬停的页面上的其他任何地方,无论那里是否有超链接。
有谁知道如何让手指指针只出现在背景上?
<style>
body {
background-image: url("/wp-content/uploads/2019/08/BottomBKG.png"), url("/wp-content/uploads/2019/08/TopBKG.png");
background-color: #000000;
background-repeat: no-repeat, no-repeat;
background-position: center bottom, center top;
background-size: 2000px 294px, 2000px 1368px;
background-attachment: fixed, scroll;
}
</style>
<script>
$('body').click(function(e){
var url = $(this).prop('href');
if (e.target === this) {
window.open('http://URLGOESHERE.com', '_blank');
}
});
</script>
【问题讨论】:
-
您需要将
cursor仍然为 body 的子元素设置为默认值,这样它们就不会从body继承cursor样式
标签: javascript jquery css wordpress