Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQuery:网站的拖放文件夹幻灯片_Javascript_Jquery_Html_Image_Slideshow - Fatal编程技术网

Javascript jQuery:网站的拖放文件夹幻灯片

Javascript jQuery:网站的拖放文件夹幻灯片,javascript,jquery,html,image,slideshow,Javascript,Jquery,Html,Image,Slideshow,我正在为我的组织创建一个网站,该网站需要有图像幻灯片。我们通常无法高质量地访问互联网,维护网站的人也不会对网页设计有很高的了解,因此频繁更新是很困难的。因此,我试图生成一个图像幻灯片,将从服务器上的特定文件夹中提取图像 这似乎就是这么做的,但是我不完全知道我在做什么。指南说,将HTML片段放在头部和身体中,这很容易 接下来,它声明将创建一个“简单子对象”,并给出以下代码 Dim oDir As New DirectoryInfo(Server.MapPath("<relative pat

我正在为我的组织创建一个网站,该网站需要有图像幻灯片。我们通常无法高质量地访问互联网,维护网站的人也不会对网页设计有很高的了解,因此频繁更新是很困难的。因此,我试图生成一个图像幻灯片,将从服务器上的特定文件夹中提取图像

这似乎就是这么做的,但是我不完全知道我在做什么。指南说,将HTML片段放在头部和身体中,这很容易

接下来,它声明将创建一个“简单子对象”,并给出以下代码

Dim oDir As New DirectoryInfo(Server.MapPath("<relative path the images>"))
Dim fileList() As FileInfo = oDir.GetFiles("*.jpg")
Dim iFileCount As Integer = fileList.Count
iFileCount -= 1
Dim oImage As HtmlImage
For i As Integer = 0 To iFileCount
    oImage = New HtmlImage
    With oImage
        .Src = String.Format("path\{0}", fileList(i))
        If i = 0 Then .Attributes.Add("class", "active")
    End With
    slideshow.Controls.Add(oImage)
Next
Dim oDir作为新的DirectoryInfo(Server.MapPath(“”)
Dim fileList()作为FileInfo=oDir.GetFiles(“*.jpg”)
Dim iFileCount As Integer=文件列表.Count
iFileCount-=1
将图像变暗为HtmlImage
对于i,作为整数=0到i计数
oImage=新HtmlImage
与oImage
.Src=String.Format(“路径\{0}”,文件列表(i))
如果i=0,则.Attributes.Add(“类”,“活动”)
以
幻灯片放映.控件.添加(oImage)
下一个
我知道“图像的相对路径”和“路径”需要用我服务器上的文件夹名称更新。。。但我不知道如何处理这个代码片段。它是否保存为新的.js文件?我在HTML中没有看到任何引用其他文件的内容

还有。。。该指南使用托管在codeproject.com上的jquery API。。。我假设它的安全分出来为同一个托管谷歌?我不想依赖codeproject.com。

要遵循的步骤

1. Open your aspx/HTML page (your code sounds as if it's an aspx page)
2. With in the head/body paste the two javascript <script>...</script> tags codeproject has mentioned.
3. Do the same for the CSS which is within <style>...</style> tag
4. Drag and Drop an HTMLImage control to your webpage and name it slideshow
5. Your Sub needs to live on the page to populate the HTMLImage control with the images.
1。打开您的aspx/HTML页面(您的代码听起来像是一个aspx页面)
2.在头部/身体中粘贴两个javascript。。。这个项目已经提到。
3.对CSS执行相同的操作,该CSS位于。。。标签
4.将HTMLImage控件拖放到网页并将其命名为slideshow
5.您的Sub需要位于页面上,才能使用图像填充HTMLImage控件。
检查HTMLImage控件是否加载了所有图像很重要。如果您正在使用Chrome测试网站,请点击F12并在名为“元素”的选项卡下查找您的控件。如果HTMLImage控件包含所有服务器端映像,那么上面提到的1-3个步骤就足够了


希望有帮助

请尝试下面提到的代码。编辑代码底端的标记,并将链接添加到src=”“中的图像文件中。由于可访问性原因,此幻灯片每7周旋转一次。如果愿意,可以将其更改为其他值。请让我知道,如果你仍然有问题解决这个

`


/***
简单jQuery幻灯片脚本
由Jon Raasch(jonraasch.com)根据FreeBSD许可证发布:免费使用或修改,
不负责任何事情等。如果您喜欢,请联系我:)
***/
函数滑动开关(){
var$active=$(“#slideshow IMG.active”);
如果($active.length==0)
$active=$(“#幻灯片显示IMG:last”);
//使用此选项可以按图像在标记中的显示顺序提取图像
var$next=$active.next().length?$active.next():$(“#幻灯片放映IMG:first”);
//取消对下面3行的注释,以随机顺序拖动图像
//var$sibs=$active.sibles();
//var rndNum=Math.floor(Math.random()*$sibs.length);
//var$next=$($sibs[rndNum]);
$active.addClass('last-active');
$next.css({
不透明度:0.0
}).addClass(“活动”).animate({
不透明度:1.0
},1000,函数(){
$active.removeClass('active last active');
});
}
$(函数(){
setInterval(函数(){
console.log(“fsdfsdf”);
滑动开关();
}, 7000);
});
/***设置宽度和高度以匹配图像**/
#幻灯片放映{
位置:相对位置;
高度:350px;
宽度:350px;
}
#幻灯片式IMG{
位置:绝对位置;
排名:0;
左:0;
z指数:8;
不透明度:0.0;
高度:350px;
宽度:350px;
}
#幻灯片显示IMG.active{
z指数:10;
不透明度:1.0;
}
#幻灯片显示IMG.last-active{
z指数:9;
}

`

该代码是
VB.net
(服务器端)代码。你有什么样的服务器?我不太清楚你的意思。据我所知,这是一个FTP网络服务器。对不起,如果那不是你想要的。我现在边学习边做,所以我的知识还存在差距。当你购买了你的托管帐户时,你可能最终使用了Windows服务器或Linux服务器。通常,共享主机帐户倾向于Linux,并且支持开箱即用的PHP。找到的代码段特定于Windows(.net)。PHP和.NET是(用外行的话说)两种不同的语言,你可以用它们编写“服务器端”代码。我仍然不确定我在用这段代码做什么。我想这就是你说的HTMLImage控件。我应该将其粘贴到文本编辑器中,并将其命名为slideshow吗?什么扩展名?好的,试着用这个代码创建一个文件,命名为slideshow.aspx,但这不对。我觉得这很容易,我只是不明白。作为背景。。。我是一名摄影师和布局设计师(拥有丰富的Adobe套件经验)。代码片段仅用于创建可以在幻灯片中保存图片的HTML元素。您使用什么语言编写代码?您是否仅使用HTML、CSS和jQuery或vb.net(在aspx中)来实现这一点?我想使用的就是任何有效的工具。我正在用HTML和
    <script src="http://code.jquery.com/jquery-1.10.2.min.js"
    type="text/javascript"></script>
    <script type="text/javascript">
        /***
         Simple jQuery Slideshow Script
         Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify,
         not responsible for anything, etc.  Please link out to me if you like it :)
         ***/

        function slideSwitch() {
            var $active = $('#slideshow IMG.active');

            if ($active.length == 0)
                $active = $('#slideshow IMG:last');

            // use this to pull the images in the order they appear in the markup
            var $next = $active.next().length ? $active.next() : $('#slideshow IMG:first');

            // uncomment the 3 lines below to pull the images in random order

            // var $sibs  = $active.siblings();
            // var rndNum = Math.floor(Math.random() * $sibs.length );
            // var $next  = $( $sibs[ rndNum ] );

            $active.addClass('last-active');

            $next.css({
                opacity : 0.0
            }).addClass('active').animate({
                opacity : 1.0
            }, 1000, function() {
                $active.removeClass('active last-active');
            });
        }

        $(function() {
            setInterval(function() {
                console.log("fsdfsdf");
                slideSwitch();
            }, 7000);
        });

    </script>
    <style type="text/css">
        /*** set the width and height to match your images **/

        #slideshow {
            position: relative;
            height: 350px;
            width: 350px;
        }

        #slideshow IMG {
            position: absolute;
            top: 0;
            left: 0;
            z-index: 8;
            opacity: 0.0;
            height: 350px;
            width: 350px;
        }

        #slideshow IMG.active {
            z-index: 10;
            opacity: 1.0;
        }

        #slideshow IMG.last-active {
            z-index: 9;
        }

    </style>
</head>
<body>
    <div id="slideshow">
        <img src="http://www.tate.org.uk/art/images/work/D/D29/D29293_10.jpg" alt="Picture 1" class="active">
        <img src="http://3.bp.blogspot.com/_ShpNcCZ0lVE/S_n3Xkv126I/AAAAAAAABbs/T0B8xwIg7Ko/s1600/IMG_7163.JPG" alt="Picture 2">
        <img src="http://www.automotofoto.net/wp-content/uploads/2012/04/Honda-World-Superbike-Team-Heads-Home-for-Round-Three-THUMBNAIL-2.jpg" alt="Picture 3">
    </div>
</body>