JQuery show/hide when hover

后端 未结 5 517
名媛妹妹
名媛妹妹 2020-12-05 13:14

I have three links, Cat, Dog, Snakes. When I hover over each, the content relating to each link should change.

So if i hover over cat, then cat content will appear,

5条回答
  •  粉色の甜心
    2020-12-05 14:09

    jquery:

    $('div.animalcontent').hide();
    $('div').hide();
    $('p.animal').bind('mouseover', function() {
        $('div.animalcontent').fadeOut();
        $('#'+$(this).attr('id')+'content').fadeIn();
    });  
    

    html:

    dog url

    Doggiecontent!

    cat url

    Pussiecontent!

    snake url

    Snakecontent!

    -edit-

    yeah sure, here you go -- JSFiddle

提交回复
热议问题