JQuery.slideDown () moves up

This works, but I'm not sure why. In function capIn(), in my opinion, the line $botcap.slideDown("slow")should shift the div down. He glides. If I try to use .slideUp(), nothing happens, as if he was trying to move it. Can someone explain this to me?

$(".slide").hover(capIn, capOut);

function capIn(){
    //slide top caption down
    var $topcap = $(this).children(".topcap");
    $topcap.slideDown("slow");

    //slide bottom caption up
    //!! Why does slideDown slide caption up here?
    var $botcap = $(this).children(".botcap");
    $botcap.slideDown("slow")
}

function capOut(){
    //slide top back up
    var $topcap = $(this).children(".topcap");
    $topcap.slideUp("slow");

    //slide bottom back down
    var $botcap = $(this).children(".botcap");
    $botcap.slideUp("slow");
}
+5
source share
3 answers

JQuery functions slideDownand slideUpare actually wrong. As stated in the documentation for slideUp:

Hide matched elements with a sliding motion.

; , , , , . , (, position: absolute bottom: 0), , .

+9

$('.botcap') .

0

, , , . : 0; , , slideDown() . , : ( ), : 0.

0

All Articles