开发者

toggle/visible check wrong behavior or a bug in the library

开发者 https://www.devze.com 2023-01-25 08:50 出处:网络
I have a section on which I call toggle() with the callback format. What I have noticed is that if I do a visible check on a child element of the togg开发者_如何学编程led section, that is always the o

I have a section on which I call toggle() with the callback format. What I have noticed is that if I do a visible check on a child element of the togg开发者_如何学编程led section, that is always the opposite. Instead of visible I get false.

I have the following code fragments:

$('.section_advanced').toggle('fast',resizeSection()); 

function resizeSection() {
    console.log($('#responsibilityLevel').is(':visible'));
    if ($('#responsibilityLevel').is(':visible')) { 
    } else {        
    }
}

where responsibilityLevel is child of of the .section_advanced section.


You need to pass the resizeSection function instead of calling it.

This:

$('.section_advanced').toggle('fast',resizeSection());

should be:

$('.section_advanced').toggle('fast',resizeSection);
0

精彩评论

暂无评论...
验证码 换一张
取 消