加入“main_background”图片展示样式失效 无图片显示
g('template_main').innerHTML+=tpl_main .replace(/{{index}}/g,'{{index}}') .replace(/{{h1}}/g,data[i].h1) .replace(/{{h2}}/g,data[i].h2); g('main_{{index}}').id='main_background';
做完这步后,大图片无显示(控制按钮缩略图正常),不能加载main-i_active样式,这是为何?
var clean_main=g('.main-i'); var clean_ctrl=g('.ctrl-i'); for(i=0;i<clean_main.length;i++) { clean_ctrl[i].className=clean_ctrl[i].className .replace(' ctrl-i_active',""); clean_main[i].className=clean_main[i].className .replace(' main-i_active',""); } main.className+=' main-i_active'; ctrl.className+=' ctrl-i_active'; 即这部分代码失效,g('.main-i');获取正常