第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

jQuery代碼 完美實(shí)現(xiàn)效果!

jQuery(document).ready(function()?{
????var?t?=?$(".dox?li"),
????????b?=?$(".dox?div");
????var?index?=?0;
????var?timer?=?null;
????//?if?(t.length?!=?b.length)?return;
????for?(var?i?=?0;?i?<?t.length;?i++)?{
????????t[i].id?=?i;
????????$(t[i]).mouseover(function()?{
????????????var?that?=?this;
????????????clearInterval(timer);
????????????timer?=?setTimeout(function()?{
????????????????for?(var?j?=?0;?j?<?b.length;?j++)?{
????????????????????b.css("display",?"none");
????????????????????t.removeClass();
????????????????};
????????????????$(that).addClass('hover');
????????????????$(b[that.id]).css("display",?"block");
????????????},?150);
????????????//?console.log(this.id)
????????????index?=?this.id;

????????});
????????$(t[i]).mouseout(function()?{
????????????//?clearInterval(timer);
????????????timer?=?setInterval(function()?{

????????????????index++;
????????????????if?(index?>=?t.length)?{
????????????????????index?=?0;
????????????????}
????????????????for?(var?j?=?0;?j?<?b.length;?j++)?{
????????????????????b.css("display",?"none");
????????????????????t.removeClass();
????????????????};
????????????????$(t[index]).addClass('hover');
????????????????$(b[index]).css("display",?"block");
????????????},?2000);
????????});
????};
????//?if?(timer)?{
????//?????clearInterval(timer);
????//?????timer?=?null;
????//?}
????timer?=?setInterval(function()?{
????????index++;
????????if?(index?>=?t.length)?{
????????????index?=?0;
????????}
????????for?(var?j?=?0;?j?<?b.length;?j++)?{
????????????b.css("display",?"none");
????????????t.removeClass();
????????};
????????$(t[index]).addClass('hover');
????????$(b[index]).css("display",?"block");
????????console.log(index);
????},?2000);
});

正在回答

3 回答

jqury相比js就是封裝了些方法,簡(jiǎn)化了方法名字而已

0 回復(fù) 有任何疑惑可以回復(fù)我~

可以優(yōu)化很多~

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

nc1199

。。。我是說還有很多地方可以優(yōu)化~
2015-09-22 回復(fù) 有任何疑惑可以回復(fù)我~
jQuery(document).ready(function()?{
????var?t?=?$(".dox?li"),
????????b?=?$(".dox?div");
????var?index?=?0;
????var?timer?=?null;
????//?if?(t.length?!=?b.length)?return;
????for?(var?i?=?0;?i?<?t.length;?i++)?{
????????t[i].id?=?i;
????????$(t[i]).mouseover(function()?{
????????????var?that?=?this;
????????????clearInterval(timer);
????????????timer?=?setTimeout(function()?{
????????????????for?(var?j?=?0;?j?<?b.length;?j++)?{
????????????????????b.css("display",?"none");
????????????????????t.removeClass();
????????????????};
????????????????$(that).addClass('hover');
????????????????$(b[that.id]).css("display",?"block");
????????????},?150);
????????????//?console.log(this.id)
????????????index?=?this.id;

????????});
????????$(t[i]).mouseout(function()?{
????????????//?clearInterval(timer);
????????????timer?=?setInterval(function()?{

????????????????index++;
????????????????if?(index?>=?t.length)?{
????????????????????index?=?0;
????????????????}
????????????????for?(var?j?=?0;?j?<?b.length;?j++)?{
????????????????????b.css("display",?"none");
????????????????????t.removeClass();
????????????????};
????????????????$(t[index]).addClass('hover');
????????????????$(b[index]).css("display",?"block");
????????????},?2000);
????????});
????};
????//?if?(timer)?{
????//?????clearInterval(timer);
????//?????timer?=?null;
????//?}
????timer?=?setInterval(function()?{
????????index++;
????????if?(index?>=?t.length)?{
????????????index?=?0;
????????}
????????for?(var?j?=?0;?j?<?b.length;?j++)?{
????????????b.css("display",?"none");
????????????t.removeClass();
????????};
????????$(t[index]).addClass('hover');
????????$(b[index]).css("display",?"block");
????????console.log(index);
????},?2000);
});


1 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

jQuery代碼 完美實(shí)現(xiàn)效果!

我要回答 關(guān)注問題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)