开发者

why the if condition can't work in jquery?

i want to remove the vertical line。which is in the red circularity. !

but when click the tab two.it showing like this:

why the if condition can't work in jquery?

The Following Code is not Working

   if($('#video开发者_运维技巧tabs1').show()){
    $('.vtab2').css('border-right', 'none');
}

when the videotabs1 show. the .vtab2 border is not removed.


show returns the jQuery instance on which it's called, which is always truthy, and so no matter what you'll go into the if's body. You might want is(":visible"), if you're trying to check if it's visible...but the tab will probably always be visible. Perhaps .hasClass("whatever") where "whatever" is whatever class you use for "active" tabs in your UI.

...in fact, this probably could be handled at the CSS end without using JavaScript at all (er, not using it specifically for this). If you have an "inactive" class you use for your inactive tabs, I'd include the border-right: none; rule in that.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜