Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the border-radius of a div on hover using jquery?

Tags:

jquery

css

hover

$('#categories').hover(
    function() {
        $(this).find('#menulist').show();
    },
    function() {
        $(this).find('#menulist').hide();
    }
)

What else should i add inside the hover function to change the border-radius property?

like image 911
Rahul_2289 Avatar asked Sep 21 '11 07:09

Rahul_2289


2 Answers

try this:

$('#categories').hover(
    function() {
        $('#menulist').show();
        $('#menulist').css('border-radius', '25px');
    },
    function() {
        $('#menulist').hide();
    }
)
like image 60
Bat_Programmer Avatar answered Sep 25 '22 19:09

Bat_Programmer


animateCorners = function(event) {

    r = (event.type == 'mouseenter' ? 40 : 0);
    $(this).css({
        'border-top-left-radius': r,
        'border-top-right-radius': r,
        'border-bottom-right-radius': r,
        'border-bottom-left-radius': r
    });

}
$('div').hover(animateCorners, animateCorners);

jsFiddle example

like image 36
Teneff Avatar answered Sep 25 '22 19:09

Teneff