var head = document.getElementById('head');
var navMain = document.getElementById('navMain');
var navLinks = document.getElementsByClassName('navLink');
var floatEnder_1 = document.getElementById('floatEnder_1');
var iMainContents = document.querySelector('iframe#iMainContents');
// function change class of #head
function changeHeadClass(from, to) {
if(head.className === from) {head.className = to;}
};
// event : click #navMain
navMain.onclick = function(){
changeHeadClass('head','head_small');
floatEnder_1.style.display = 'none';
if(iMainContents.style.display == 'none') {
iMainContents.style.display = 'initial';
};
}
Please watch above codes. I'm trying to do unobtrusive js coding, but it is more difficult than insert js event code in html.
When you see above, most of codes are works fine. but only one sentence, if(iMain...)
isn't working. I read 'javascript definition guide 5th' and console report of browsers, but can't find the reason of the problem...
I wrote my codes above there.