鼠标悬停图片更改

时间:2015-07-10 12:52:02

标签: image mouseover fadein fadeout

我试图在鼠标悬停时进行模糊图像更改。当放大其他物体时,像某些物体放大和缩小某些物体的东西会变得模糊。理解我想要的东西的最佳方法是在这里看到它: http://berger.co.rs/test/test.html

我只有一个问题。鼠标悬停图像始终位于活动图像后面。我需要只有活动图像,当应用鼠标悬停时,然后更改图像。此外,我不希望活动图像总共消失,然后加载鼠标悬停图像。我需要它像上面的例子,只是不要一直显示鼠标悬停图像。

您可以在页面源中看到我的完整代码。

你能帮帮我吗?

1 个答案:

答案 0 :(得分:0)

首先欢迎使用Stackoverflow,作为新用户,请阅读本指南,以便您可以提出更好的问题并获得更好,更快的答案:

https://stackoverflow.com/help/how-to-ask

请避免评论代码。如果有人要求您提供其他代码,请将其包含在问题中。

现在回答:

问题在于您没有为$()命令提供Jquery。 " alturl.com/bcfhv"不正确。

这里,把它存档,它正在工作:

<html>
<body>
<style>
    div{ 
        position:relative; 
        width:714px; 
        height:420; 
        overflow:hidden; 
    } 
    span { 
        position:absolute; 
        top:0px; 
        left:-0px; 
    } 
</style>
<div> 
    <img src="http://berger.co.rs/test/img/mouseover.png" width="714" height="421"/> 
    <span> 
        <img src="http://berger.co.rs/test/img/active.png" width="714" height="421"/> 
    </span> 
</div>

<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
    $(document).ready(function() { 
        alert('ok')
        $("div").hover(function() { 
            $("span").fadeIn(); 
        }, function() { 
            $("span").fadeOut(); 
        }); 
    })
</script>

</body>
</html>

或看到它有效here

相关问题