当值为 0 或 JavaScript 中数组中的最高数字时,我的可见性有问题
这是我的代码...
<!-- script fotoviewer -->
<script>
$("#fotoviewerclick").click(function(){
$("#wrapper").fadeIn(1000);
$("#lightbox").fadeIn(1000);
})
$("#lightboxbtnclose").click(function(){
$("#wrapper").fadeOut(400);
$("#lightbox").fadeOut(400);
})
$("#wrapper").click(function(){
$("#wrapper").fadeOut(400);
$("#lightbox").fadeOut(400);
})
var imagenumber = 0;
var imagenumber_count = 1;
var imagenumber_total_count = imagelist.length;
document.getElementById('counter_total').innerHTML = imagelist.length;
function btnleft(){
var load = imagelist[imagenumber-=1];
if (imagenumber_count > 1){imagenumber_count -= 1; document.getElementById('counter').innerHTML = imagenumber_count;}
if (load) // imagenumber in array boundaries
document.getElementById('lightboxcontent').innerHTML = load;
else
imagenumber = 0;
}
function btnright(){
if (imagenumber_count < imagenumber_total_count) {
imagenumber_count += 1;
document.getElementById('counter').innerHTML = imagenumber_count;
}
var load = imagelist[imagenumber+=1];
if (load){ // imagenumber in array boundaries
document.getElementById('lightboxcontent').innerHTML = load;
}
else{
imagenumber = imagelist.length-1;}
}
</script>
当第一张照片出现在查看器中时,我不想要上一张。显示按钮,并且当我在最后一张图片上时,下一个按钮不会显示
有谁能帮助我吗?
谢谢!!
PS.:对不起我的英语不好,我来自比利时