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

為了賬號安全,請及時綁定郵箱和手機立即綁定

鼠標移開之后,自動切換默認是之前的,并不是鼠標之后的下一位

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);

?? ??? ?});
?? ??? ?$(t[i]).mouseout(function() {
?? ??? ??? ?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 回答

?$(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");
????????????????index?=?that.id;
????????????},?150);

鼠標劃過標簽的時候并沒有修改index的值,這樣當鼠標離開當前標簽后index的值是上次自動播放的index+1。解決辦法是在鼠標劃過標簽后,把index的值修改為標簽的id值,這樣下次自動播放時就會從劃過標簽的下一個標簽開始。代碼如上,添加的代碼在倒數(shù)第二行。

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

Hakuna_Matata 提問者

非常感謝!
2016-02-26 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

鼠標移開之后,自動切換默認是之前的,并不是鼠標之后的下一位

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

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

幫助反饋 APP下載

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

公眾號

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