简体   繁体   English

悬停在背景1上时,将光标替换为图像

[英]Replace cursor with image when hovering over background 1

I am trying to show a png instead of my cursor for stage 1 of my website. 我正在尝试显示png而不是我的网站第1阶段的光标。 The background image transitions are in jQuery and the rest in PHP, CSS, HTML. 背景图像转换使用jQuery,其余转换使用PHP,CSS,HTML。 I researched and used a code that everyone seems to use but the cursor won't show up. 我研究并使用了每个人似乎都在使用的代码,但光标不会出现。 I checked if the naming of the image is correct and the path. 我检查了图像的命名和路径是否正确。 Inspect element on Chrome shows no errors either. Chrome上的Inspect元素也未显示任何错误。 Let me know if you can find the mistake... 让我知道您是否能找到错误...

The cursor should appear with the first background only ("top"). 光标应仅显示第一个背景(“顶部”)。 Any tips highly appreciated! 任何提示高度赞赏!

CSS: CSS:

.top {
     position: absolute;
     top: 0px;
     bottom: 0px;
     left: 0px;
     right: 0px;
     z-index: 100;
     width: 100%;
}

.top: hover {
    cursor: url("images/cursorcamera.png");

jQuery jQuery的

$(document).ready(function(){
    var audioElement = document.createElement('audio');
    audioElement.setAttribute('src', 'audio/camera.wav');

    $('*').click(function(){
        audioElement.play();
        $('.top').fadeOut('slow')

       // $('.second').fadeOut('slow').delay(1000);
        $('.second').delay(5000).fadeOut();
        $('#counter').delay(5000).fadeOut();
   });
});

Dont use hover. 不要使用悬停。 Declare the curser url in your top css Element and it will work when you hover over the Element with your mouse. 在顶部CSS元素中声明光标URL,当您将鼠标悬停在Element上时,它将起作用。

I tried this and the pointer shows up, not the image...so it works somehow just not the image... 我尝试了这个,但指针显示了,而不是图像...所以它以某种方式起作用而不是图像...
.top { position: absolute; .top {位置:绝对; top: 0px; 顶部:0px; bottom: 0px; 底部:0px; left: 0px; 左:0px; right: 0px; 右:0px; z-index: 100; z索引:100; width: 100%; 宽度:100%; cursor: url(images/cursorcamera.png), pointer; 光标:url(images / cursorcamera.png),指针; } }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM