图像悬停在消失的jquery上

时间:2014-02-02 04:05:02

标签: javascript jquery

嗨我想在我离开按钮时让我的图像消失,当我继续它时出现,这是我的代码,为什么它不起作用?我已经包含了我们正在使用的所有html和所有文件,但它似乎仍无效。

   <?php
    session_start();
    if (isset($_SESSION['user'])) {
    header('Location:/LogIn/postlogin');
    }

?>
<html>
    <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>

$('.button1').on('mouseover', function () {

             $("#image1").fadeIn(250);


          });

          $('.button1').on('mouseleave', function () {
             $("#image1").fadeOut(0);

          });
  $('.button4').on('mouseover', function () {

             $("#about").fadeIn(250);
        $("#frame").fadeIn(250);

          });

          $('.button4').on('mouseleave', function () {
             $("#about").fadeOut();
        $("#frame").fadeOut();

          });



</script>

    <title> Blue Bear </title>

    <meta name ="description" content = "kunal is a fag ;)">
    <meta name = "author" content = "Jason Bao and Kunal Desai(fag <3)">



    <link rel="stylesheet" href="css/all.css" type="text/css" />


    </head>

    <body>
        <header>
        <!-- /*<section id="menubar">

            <table>
            <ul id="main">
                <li><a href = "/">Home</a></li> 
                <li><a href = "/AboutUs">About Us</a></li>

            </ul>
            </table>

        </section>*/ --!>
        </header>
    <a class="button1" href="/home">Home</a>
    <a class="button2" href = "/signup">Join</a>    
    <a class="button3" href="/LogIn">Log In</a>
    <a class="button4" href = "/about">About Us</a>
    <a class="button12" href = "/about">About Us <br>
    <p id = "about" >co-Founders Kunal and Jason</p></a>
    <img id = "image1" border="0" src="../Images/1.png"  width="500" height="300"></img>
<img id = "image2" border="0" src="../Images/2.png"  width="500" height="300"></img>
<img id = "image3" border="0" src="../Images/1.png"  width="500" height="300"></img>
    <a id = "frame"></a>

    </body>


</html>

1 个答案:

答案 0 :(得分:0)

试试这个,

$(document).ready(function(){

$('.button1').mouseover(function () {

             $("#image1").fadeIn(250);


          });

          $('.button1').mouseout(function () {

             $("#image1").fadeOut(0);

          });
});

演示链接http://jsfiddle.net/dhana36/ZLsjv/