jQuery Animate - border color and width

前端 未结 5 1791
忘掉有多难
忘掉有多难 2020-12-16 20:16

I cannot seem to get this jQuery animation working for applying a border to an image on mouseenter:

5条回答
  •  一生所求
    2020-12-16 20:58

    You have some typos in your code

    1. .mousenter should be .mouseenter

    2. didnt close the apostrophe in both 'borderColor. change them to 'borderColor'

    $('div img').mouseenter(function(){
        $(this).css("border", "0px solid #f37736").animate({
            'borderWidth': '4px',
            'borderColor': '#f37736'
        },500);
    }).mouseleave(function(){
         $(this).animate({
            'borderWidth':'0px',
            'borderColor':'#f37736'
        },500);
    });
    

提交回复
热议问题