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?
精彩评论