Moustafa Abdul Kareem
Moustafa Abdul Kareem

Reputation: 29

how to do this dropdown with jquery

i have a jquery login drop down

I use this code to show the login <div>:

$(document).ready(function() {
    $('.vv2').hover(function() {
        $('#boxa').slideDown('slow');                                                 
    });
});

I want to know how to hide it again if the user go away from the login area.

the code here http://www.sprnt.net/sprnt/

the first button in the top left screen

Upvotes: 3

Views: 117

Answers (4)

Manish Shrivastava
Manish Shrivastava

Reputation: 32050

It's very easy ref: Hover to handle mouse move jQuery slide Up and jQuery slide Down

Upvotes: 0

Umesh Patil
Umesh Patil

Reputation: 10685

$(document).ready(function() {
    $('.vv2').hover(
    function() {
        $('#boxa').slideDown('slow');                                                 
    },
    function() {
        $('#boxa').slideUp('slow');                                                 
    }
);
});

just wanted to tell, hover event takes two functions. See here jquery Docs

Upvotes: 0

Bart Vangeneugden
Bart Vangeneugden

Reputation: 3446

$(document).ready(function(){
        $('.vv2').mouseout(function(){
            $('#boxa').slideUp('slow');                                                 
        });
});

Upvotes: 0

Sagar Patil
Sagar Patil

Reputation: 1948

Try this:

$(document).ready(function(){
    $('.vv2').hover(function(){
      $('#boxa').slideDown('slow');                                                 
    }, function(){
      $('#boxa').slideUp('slow');
    });

});

When using hover, you can pass 2 functions, the first for mouseOver and the second for mouseOut.

Upvotes: 3

Related Questions