Javascript 网格中的随机徽标
我想在jQuery中创建一个标识墙,就像在世界上最好的可信部分的网站上一样 同样的道理:8个带有淡入淡出的徽标 能帮我点忙吗Javascript 网格中的随机徽标,javascript,jquery,Javascript,Jquery,我想在jQuery中创建一个标识墙,就像在世界上最好的可信部分的网站上一样 同样的道理:8个带有淡入淡出的徽标 能帮我点忙吗 <div class="client-logos-grid"> <a href="" class="client-logo"><img src="" alt=""></a> <a href="" class="client-logo"><img src="" alt=""&
<div class="client-logos-grid">
<a href="" class="client-logo"><img src="" alt=""></a>
<a href="" class="client-logo"><img src="" alt=""></a>
<a href="" class="client-logo"><img src="" alt=""></a>
<a href="" class="client-logo"><img src="" alt=""></a>
<a href="" class="client-logo"><img src="" alt=""></a>
<a href="" class="client-logo"><img src="" alt=""></a>
<a href="" class="client-logo"><img src="" alt=""></a>
<a href="" class="client-logo"><img src="" alt=""></a>
</div>
$function{
//每20分钟打一次电话
设置间隔函数{
改变标志;
}, 200;
};
功能变更标志{
//第一个积极的标志
var shownLogo=$.client logos grid.find'.client logo:not.hidden';
var shownLogo=$.client logos grid.find'.client logo:not.hidden';
shownLogo.fadeOut200,功能{
shownLogo.addClass“隐藏”;
//检查它是否是行中的最后一个徽标
如果shownLogo.next'.client logo'.length>0{//不是最后一个
shownLogo.next'.client logo'.fadeIn400,函数{
shownLogo.next'.client logo'.removeClass'hidden';
};
}否则{//last
//移到第一位
$'.客户端徽标:第一个'.fadeIn400,函数{
$”。客户端徽标:第一个。removeClass“隐藏”;
};
}
};
}
.隐藏{
显示:无;
}
我检查了他们的网站,他们用它来制作徽标转换的动画 您也可以使用
可以看到演示web希望这有帮助看起来您忘记添加JS代码了..?您需要提供JS代码作为well@CBroe是的,但我的评论更礼貌地表达了这个想法。这最终似乎是一个错误的假设,OP似乎有一个尝试。@Jandon,请将您的代码添加到问题中,并不是每个人都喜欢被转发到外部站点来尝试回答一个问题仅供参考,每个人-他的另一半在这里讨论同一个问题,不过,从A到B的转换比其他转换需要更多的时间。我正在设法解决它。欢迎来自社区的任何帮助。对不起,我没有给第二个锚定标签发短信。现在更正了,谢谢!我尝试创建与相同的系统。8个徽标显示和1个替换随机1个徽标
$('document').ready(function() {
var curIndex = 0;
var src = ['http://www.jqueryscript.net/images/Simplest-Responsive-jQuery-Image-Lightbox-Plugin-simple-lightbox.jpg', 'http://www.jqueryscript.net/images/Simplest-Responsive-jQuery-Image-Lightbox-Plugin-simple-lightbox.jpg', 'http://www.jqueryscript.net/images/Simplest-Responsive-jQuery-Image-Lightbox-Plugin-simple-lightbox.jpg'];
var fadeTimeInMilliseconds = 2000;
var waitTimeInMilliseconds = 5000;
$(document).ready(function() {
switchImageAndWait(true);
});
function switchImageAndWait(fadeOut2) {
if (fadeOut2) {
setTimeout(fadeOut, waitTimeInMilliseconds);
} else {
var index = Math.floor((Math.random() * src.length))
if (curIndex == index) {
index++;
if (index >= src.length) {
index -= 8;
}
}
curIndex = index;
$(".client-logo img").attr("src", src[index]);
fadeIn();
}
}
function fadeOut() {
$(".client-logo img").fadeTo(fadeTimeInMilliseconds, 0, function() {
switchImageAndWait(false);
});
}
function fadeIn() {
$(".client-logo img").fadeTo(fadeTimeInMilliseconds, 1, function() {
switchImageAndWait(true);
});
}
});
<div id="slideshow">
<li><a href="link1.html"><img src="images/4.jpg" width="640" height="480" border="0" alt="" /></a></li> <!-- This is the last image in the slideshow -->
<li><a href="link2.html"><img src="images/3.jpg" width="640" height="480" border="0" alt="" /></a></li>
<li><a href="link3.html"><img src="images/2.jpg" width="640" height="480" border="0" alt="" /></a></li>
<li><a href="link4.html"><img src="images/1.jpg" width="640" height="480" border="0" alt="" /></a></li> <!-- This is the first image in the slideshow -->
</div>
jQuery(document).ready(function(){
jQuery('#slideshow').fadeSlideShow();
});