在学习APICloud, 还是需要实践
// 随意切换按钮 function randomSwitchBtn( tag ) { /* if( tag == $api.dom('#footer li.f_0') )return; var eFootLis = $api.domAll('#footer li'), eHeaderLis = $api.domAll('header li'), index = 0; for (var i = 0,len = eFootLis.length; i < len; i++) { if( tag == eFootLis[i] ){ index = i; }else{ $api.removeCls(eFootLis[i], 'f_0'); $api.removeCls(eHeaderLis[i], 'active'); } } $api.addCls( eFootLis[index], 'f_0'); $api.addCls( eHeaderLis[index], 'active'); api.setFrameGroupIndex({ name: 'group', index: index }); */ if( tag == $api.dom('#footer li.f_0 a') )return; var eFootLis = $api.domAll('#footer li a'); eFootLisMyGy = $api.domAll('#footer li'); eHeaderLis = $api.domAll('header li'), index = 0; for (var i = 0,len = eFootLis.length; i < len; i++) { if( tag == eFootLis[i] ){ index = i; }else{ $api.removeCls(eFootLisMyGy[i], 'f_0'); $api.addCls( eFootLisMyGy[i], 'f_c'); $api.removeCls(eHeaderLis[i], 'active'); } } //alert(index); $api.removeCls(eFootLisMyGy[index], 'f_c'); $api.addCls( eFootLisMyGy[index], 'f_0'); $api.addCls( eHeaderLis[index], 'active'); api.setFrameGroupIndex({ name: 'group', index: index }); }
界面代码
<div id="footer" class="comiis_foot_memu bg_f b_t"> <ul class="comiis_flex"> <li class="flex f_0"><a href="javascript:;" onclick="randomSwitchBtn( this );" title="精选"><i class="comiis_font"></i> <span>精选</span></a></li> <li class="flex f_c"><a href="javascript:;" onclick="randomSwitchBtn( this );" title="社区"><i class="comiis_font"></i> <span>社区</span></a></li> <li class="flex f_c"><a href="javascript:;" onclick="randomSwitchBtn( this );" title="部落"><i class="comiis_font"></i> <span>部落</span></a></li> <li class="flex f_c"><a href="javascript:;" onclick="randomSwitchBtn( this );" title="我的"><i class="comiis_font"></i> <span>我的</span></a></li> </ul> </div>
0则评论给“测试APICloud的一段代码”