两个 div 之间的循环淡入淡出 - 需要修改才能回答这个 post
Looping fade between two divs - require modification to answer to this post
已接受的 this Whosebug question 答案正是我需要的,但 稍作修改。
我需要多个 .boxes
。不止一个。
每个 "box" 有两个 div 需要淡入淡出。
来自这段代码:
$(document).ready(function () {
var allBoxes = $("span.boxes").children("span");
transitionBox(null, allBoxes.first());
});
我知道我应该首先将所有 .boxes
放入一个数组,然后遍历该数组以获取它们的每个子 span
元素。
但我不完全确定这是 (a) 最佳做法,(b) 正确,以及 (c) 首先是否有更好的方法。
你的意思是这样的吗http://jsfiddle.net/8odoros/CYJLA/306/?
使用
$( "div.boxes" ).each(function( index ) {
var allBoxes = $(this).children("div");
transitionBox(null, allBoxes.first());
});
对所有 .boxes
应用相同的效果
已接受的 this Whosebug question 答案正是我需要的,但 稍作修改。
我需要多个 .boxes
。不止一个。
每个 "box" 有两个 div 需要淡入淡出。
来自这段代码:
$(document).ready(function () {
var allBoxes = $("span.boxes").children("span");
transitionBox(null, allBoxes.first());
});
我知道我应该首先将所有 .boxes
放入一个数组,然后遍历该数组以获取它们的每个子 span
元素。
但我不完全确定这是 (a) 最佳做法,(b) 正确,以及 (c) 首先是否有更好的方法。
你的意思是这样的吗http://jsfiddle.net/8odoros/CYJLA/306/?
使用
$( "div.boxes" ).each(function( index ) {
var allBoxes = $(this).children("div");
transitionBox(null, allBoxes.first());
});
对所有 .boxes