-
郑文华 小试身手Lv3
发表于2020-2-16 20:48
楼主
本帖最后由 郑文华 于 2020-2-16 20:49 编辑
说明:下面脚本是通过点击按钮来显示对应的tab标签页,如果要想鼠标悬停切换tab页,把注释去掉即可。
复制代码
说明:下面脚本是通过点击按钮来显示对应的tab标签页,如果要想鼠标悬停切换tab页,把注释去掉即可。
- function checkBtnAndBindTab(btns, tabctrlId) {
- var ready =true;
- var btnDoms = [];
- if(!g_rptpage.calcParam){
- ready = false;
- }else{
- for (var i = 0, l = btns.length; i < l; i++) {
- var param = g_rptpage.calcParam.getParamByName(btns[i]);
- if(!param){
- ready =true;
- break;
- }
- btnDoms.push(param.getBaseDom());
- }
- }
- if(!ready){
- var func = checkBtnAndBindTab.bind(window,btns,tabctrlId);
- setTimeout(func,1);
- }else{
- window["current_active_btn_idx"] = 0;
- var bindTabClick = function(tabctrlId,idx){
- window["current_active_btn_idx"] = idx;
- g_rptpage.widgets[tabctrlId].setActive(idx);
- };
- /*
- *如果想要悬停切换的效果,把该注释去掉
- var bindTabHover = function(tabCtrlId,idx){
- EUI.execDomEvent(btnDoms[idx],"click");
- };
- */
- var autoCheckBtn = function(){
- var nextidx = (window["current_active_btn_idx"]+1)%btnDoms.length;
- EUI.execDomEvent(btnDoms[nextidx],"click");
- };
- for(var i=0,l=btnDoms.length;i<l;i++){
- EUI.addEvent(btnDoms[i],"click",bindTabClick.bind(btnDoms[i],tabctrlId,i));
- /*
- *如果想要悬停切换的效果,把该注释去掉
- jQuery(btnDoms[i]).hover(bindTabHover.bind(btnDoms[i],tabctrlId,i));
- */
- }
- }
- }
- checkBtnAndBindTab(["@qq","@ww","@ee","@rr"],"HHH2");