2024年2月19日发(作者:睦芸熙)
tab选项卡转换html,html5移动端Tab选项卡切换代码特效描述:html5移动端 Tab选项卡切换。html5移动端Tab选项卡切换代码代码结构1. HTML代码 = function (){var windowWidth = Width; //window 宽度;var wrap = mentById('wrap');var tabClick = electorAll('.tabClick')[0];var tabLi = mentsByTagName('li');var tabBox = electorAll('.tabBox')[0];var tabList = electorAll('.tabList');var lineBorder = electorAll('.lineBorder')[0];var lineDiv = electorAll('.lineDiv')[0];var tar = 0;var endX = 0;var dist = 0;ow='hidden';on='relative';=windowWidth*+"px";for(var i = 0 ;itabList[i].=windowWidth+"px";tabList[i].='left';tabList[i].='left';tabList[i].g='0';tabList[i].='0';tabList[i].alAlign='top';
tabList[i].y='table-cell';}for(var i = 0 ;itabLi[i].start = i;tabLi[i].onclick = function(){var star = ;for(var i = 0 ;itabLi[i].className='';};tabLi[star].className='active';me(lineDiv,windowWidth/*star)ate(tabBox,windowWidth,star);endX= -star*windowWidth;}}function OnTab(star){if(star<0){star=0;}else if(star>=){star=-1}for(var i = 0 ;itabLi[i].className='';};tabLi[star].className='active';ate(tabBox,windowWidth,star);endX= -star*windowWidth;};ntListener('touchstart',chstart,false);ntListener('touchmove',chmove,false);ntListener('touchend',chend,false);//按下function chstart(ev){tDefault;
var touch = s[0];tar=;Transition='all 0s ease-in-out';tion='all 0s ease-in-out';};//滑动function chmove(ev){var stars = elector('.active').start;tDefault;var touch = s[0];var distance = -tar;dist = distance;(tabBox,windowWidth,tar,distance,endX);me(lineDiv,-dist/-endX/4);};//离开function chend(ev){var str= orm;var strs = ify((",",1));endX = Number((14,-18));if(endX>0){(tabBox,windowWidth,tar,0,0,0.3);endX=0}else if(endXendX=-windowWidth*+(tabBox,windowWidth,tar,0,endX,0.3);}else if(distOnTab(elector('.active').start+1);(tabBox,windowWidth,tar,0,endX,0.3);}else if(dist>windowWidth/3){OnTab(elector('.active').start-1);}else{OnTab(elector('.active').start);}
var stars = elector('.active').start;me(lineDiv,stars*windowWidth/4);};};var init={translate:function(obj,windowWidth,star){Transform='translate3d('+-star*windowWidth+'px,0,0)';orm='translate3d('+-star*windowWidth+',0,0)px';Transition='all 0.3s ease-in-out';tion='all 0.3s ease-in-out';},touchs:function(obj,windowWidth,tar,distance,endX){Transform='translate3d('+(distance+endX)+'px,0,0)';orm='translate3d('+(distance+endX)+',0,0)px';},lineAnme:function(obj,stance){Transform='translate3d('+stance+'px,0,0)';orm='translate3d('+stance+'px,0,0)';Transition='all 0.1s ease-in-out';tion='all 0.1s ease-in-out';},back:function(obj,windowWidth,tar,distance,endX,time){Transform='translate3d('+(distance+endX)+'px,0,0)';orm='translate3d('+(distance+endX)+',0,0)px';Transition='all '+time+'s ease-in-out';tion='all '+time+'s ease-in-out';},}
2024年2月19日发(作者:睦芸熙)
tab选项卡转换html,html5移动端Tab选项卡切换代码特效描述:html5移动端 Tab选项卡切换。html5移动端Tab选项卡切换代码代码结构1. HTML代码 = function (){var windowWidth = Width; //window 宽度;var wrap = mentById('wrap');var tabClick = electorAll('.tabClick')[0];var tabLi = mentsByTagName('li');var tabBox = electorAll('.tabBox')[0];var tabList = electorAll('.tabList');var lineBorder = electorAll('.lineBorder')[0];var lineDiv = electorAll('.lineDiv')[0];var tar = 0;var endX = 0;var dist = 0;ow='hidden';on='relative';=windowWidth*+"px";for(var i = 0 ;itabList[i].=windowWidth+"px";tabList[i].='left';tabList[i].='left';tabList[i].g='0';tabList[i].='0';tabList[i].alAlign='top';
tabList[i].y='table-cell';}for(var i = 0 ;itabLi[i].start = i;tabLi[i].onclick = function(){var star = ;for(var i = 0 ;itabLi[i].className='';};tabLi[star].className='active';me(lineDiv,windowWidth/*star)ate(tabBox,windowWidth,star);endX= -star*windowWidth;}}function OnTab(star){if(star<0){star=0;}else if(star>=){star=-1}for(var i = 0 ;itabLi[i].className='';};tabLi[star].className='active';ate(tabBox,windowWidth,star);endX= -star*windowWidth;};ntListener('touchstart',chstart,false);ntListener('touchmove',chmove,false);ntListener('touchend',chend,false);//按下function chstart(ev){tDefault;
var touch = s[0];tar=;Transition='all 0s ease-in-out';tion='all 0s ease-in-out';};//滑动function chmove(ev){var stars = elector('.active').start;tDefault;var touch = s[0];var distance = -tar;dist = distance;(tabBox,windowWidth,tar,distance,endX);me(lineDiv,-dist/-endX/4);};//离开function chend(ev){var str= orm;var strs = ify((",",1));endX = Number((14,-18));if(endX>0){(tabBox,windowWidth,tar,0,0,0.3);endX=0}else if(endXendX=-windowWidth*+(tabBox,windowWidth,tar,0,endX,0.3);}else if(distOnTab(elector('.active').start+1);(tabBox,windowWidth,tar,0,endX,0.3);}else if(dist>windowWidth/3){OnTab(elector('.active').start-1);}else{OnTab(elector('.active').start);}
var stars = elector('.active').start;me(lineDiv,stars*windowWidth/4);};};var init={translate:function(obj,windowWidth,star){Transform='translate3d('+-star*windowWidth+'px,0,0)';orm='translate3d('+-star*windowWidth+',0,0)px';Transition='all 0.3s ease-in-out';tion='all 0.3s ease-in-out';},touchs:function(obj,windowWidth,tar,distance,endX){Transform='translate3d('+(distance+endX)+'px,0,0)';orm='translate3d('+(distance+endX)+',0,0)px';},lineAnme:function(obj,stance){Transform='translate3d('+stance+'px,0,0)';orm='translate3d('+stance+'px,0,0)';Transition='all 0.1s ease-in-out';tion='all 0.1s ease-in-out';},back:function(obj,windowWidth,tar,distance,endX,time){Transform='translate3d('+(distance+endX)+'px,0,0)';orm='translate3d('+(distance+endX)+',0,0)px';Transition='all '+time+'s ease-in-out';tion='all '+time+'s ease-in-out';},}