测试APICloud的一段代码

作者:流沙 分类: Android 发布于:2017-5-18 18:02 ė422次浏览 60条评论

在学习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

发表评论

电子邮件地址不会被公开。必填项已用*标注


Ɣ回顶部