开发者

Changing the visibility of a div according to body class with javascript

How to JS this?

I开发者_运维技巧f body has class "classA" Then display:block class "visibleclass"


if($('body.classA').length > 0)
    $('.visibleclass').css('display','block');


if (/\bclassA\b/.test(document.body.className)) {
    var els = document.getElementsByClassName('visibleclass'),
        len = els.length, i;

    for (i = 0; i < len; i++) {
        els[i].style.display = 'block';
    }
}

But why?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜