Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jquery mouseup无法正常工作_Javascript_Jquery_Html - Fatal编程技术网

Javascript jquery mouseup无法正常工作

Javascript jquery mouseup无法正常工作,javascript,jquery,html,Javascript,Jquery,Html,上面是参考中的网站,我正在使用一些jquery函数,我不知道为什么mouseup一个不能工作 这是jquery,它在头部内部,是的,我在那里也有一个jquery的参考 这是相关的html 我希望发生的事情:当单击图像时,只要鼠标按下,我就希望图像更改,当用户放开或离开该区域时,图像将更改回原始图像。mousedown和mouseout事件工作正常。这是没有意义的,因为当我创建mouseout事件时,我只是复制并粘贴了mouseup事件并更改了事件。 问题是:mouseup事件不会将原始图像及

上面是参考中的网站,我正在使用一些jquery函数,我不知道为什么mouseup一个不能工作

这是jquery,它在头部内部,是的,我在那里也有一个jquery的参考

这是相关的html


我希望发生的事情:当单击图像时,只要鼠标按下,我就希望图像更改,当用户放开或离开该区域时,图像将更改回原始图像。mousedown和mouseout事件工作正常。这是没有意义的,因为当我创建mouseout事件时,我只是复制并粘贴了mouseup事件并更改了事件。 问题是:mouseup事件不会将原始图像及其属性放回原处,我相信它是正确的图像,但无重复中心和大小不适用,但它们适用于mouseut函数


我很困惑,你能试试这个吗。我试过了

$(文档).ready(函数()
{
$(“#可点击”).mouseup(函数()
{
$(this.css({“background”):'url('http://igt.bitballoon.com/images/clickani.png)无重复中心',“背景大小”:“75%75%”;
});
$(“#可点击”).mouseout(函数()
{
$(this.css({“background”):'url('http://igt.bitballoon.com/images/clickani.png)无重复中心',“背景大小”:“75%75%”;
});
$(“#可点击”).mousedown(函数()
{
$(this.css({“background”):'url('http://igt.bitballoon.com/images/clickdown.png)无重复中心',“背景大小”:“75%75%”;
});

});这是不好的做法。您应该在css中创建类并分配适当的类。然后,您甚至可以忘记在这种情况下使用伪类来使用javascript。请尝试删除mouseup处理程序,我怀疑mouseup和mouseut相互干扰。我的答案对您有用吗you@MarkusZeller不知道该怎么做。@PatrickHund那对我也不管用
$(document).ready(function()
{
    $("#Clickables").mouseup(function() 
    {
        $(this).css({"background":'url("http://igt.bitballoon.com/images/clickani.png") no-repeat center', "background-size":"75% 75%"});
    });

    $("#Clickables").mouseout(function() 
    {
        $(this).css({"background":'url("http://igt.bitballoon.com/images/clickani.png") no-repeat center', "background-size":"75% 75%"});
    });

    $("#Clickables").mousedown(function()
    {
        $(this).css({"background":'url("http://igt.bitballoon.com/images/clickdown.png") no-repeat center', "background-size":"75% 75%"});
    });
});
<div id="Clickables" class="blockclicker" onclick="GatherMoney();">
</div>