Php Javascript Gallery如何更改图像大小和位置并通过图像保持循环 [英] Php Javascript Gallery How Do I Change Image Size And Position And Keep Looping Through The Images

查看:57
本文介绍了Php Javascript Gallery如何更改图像大小和位置并通过图像保持循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi


我创建了一个php javascript图库。我想知道如何给图像赋予最大高度并将它们放在页面上。我也想知道如何让图像永远保持旋转。



任何帮助都非常感谢

klein



这是我的代码

hi
I have created a php javascript image gallery. I would like to know how to give a maximum height to the images and center them on the page. I would also like to know how I can keep the images rotating forever.

any help is much appreciated
klein

here is my code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
<link rel="stylesheet" href="css2.css">


<body>
    <div id="slideshow">
            $path = "slideshowimages2";
    $all_files = scandir($path);
    $how_many = count($all_files);
        for ($i=2; $i<$how_many;$i++) {

            $kubi=$i - 1;

            echo "<img src=\"slideshowimages2/$all_files[$i]\" id= \"$kubi\"/>";
        }
    ?>
    </div>

<script>
var firstPicture = document.getElementById("1");
var picture = firstPicture ;
var i = 0;
function rotateImages() {
    // hide current element
    picture.style.display = "none";

    // choose who is the next element
    if (i >= document.getElementById("slideshow").childNodes.length) {
        i = 0;
        picture = firstPicture;
    } else {
        picture = picture.nextSibling;
    }

    // show the next element
    picture.style.display = "inline"
    i++;
};
window.onload = function(){
var curImg = document.getElementById("1").style.display = "inline";
setInterval(rotateImages, 2500);
};
</script>
</body>
</html>

推荐答案

path =slideshowimages2;
path = "slideshowimages2";


all_files = scandir(
all_files = scandir(


path);


这篇关于Php Javascript Gallery如何更改图像大小和位置并通过图像保持循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆