我有一个简单的div衰落滑块,可在Chrome,Firefox和iPad上使用,但无法在Safari浏览器中启动。下一个/后锚不触发该功能。他们甚至都没有在悬停上显示小指。有没有人遇到这个问题或知道可能的解决方案?
window.onload = function () {
$(".divs div").each(function(e) {
if (e != 0)
$(this).hide();
});
$("#next").click(function(){
if ($(".divs div:visible").next().length != 0)
$(".divs div:visible").fadeOut(function(){
$(this).next().fadeIn();
});
else {
$(".divs div:visible").fadeOut(function(){
$(".divs div:first").fadeIn();
});
}
return false;
});
$("#prev").click(function(){
if ($(".divs div:visible").prev().length != 0)
$(".divs div:visible").fadeOut(function(){
$(this).prev().fadeIn();
});
else {
$(".divs div:visible").fadeOut(function(){
$(".divs div:last").fadeIn();
});
}
return false;
});
}
的HTML
<div class="divs">
<div class="cls1">..image/text..</div>
<div class="cls2">..image/text..</div>
<div class="cls3">..image/text..</div>
...
</div>
<a id="prev" href="#"></a>
<a id="next" href="#"></a>
我在Safari上测试了您的脚本,并且对我有用。也许您应该尝试删除脚本。即使不能解决问题,将来也肯定会避免损坏脚本:
$(".divs div").each(function (e) {
if (e !== 0) {
$(this).hide();
}
});
$("#next").click(function () {
if ($(".divs div:visible").next().length !== 0) {
$(".divs div:visible").fadeOut(function () {
$(this).next().fadeIn();
});
} else {
$(".divs div:visible").fadeOut(function () {
$(".divs div:first").fadeIn();
});
}
return false;
});
$("#prev").click(function () {
if ($(".divs div:visible").prev().length !== 0) {
$(".divs div:visible").fadeOut(function () {
$(this).prev().fadeIn();
});
} else {
$(".divs div:visible").fadeOut(function () {
$(".divs div:last").fadeIn();
});
}
return false;
});
小提琴:http : //jsfiddle.net/624wu49h/
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句