doutongwei4380 2012-12-05 17:43
浏览 52
已采纳

使用php加载图像并在图库中显示

I have made a javascript code that load dinamically images in a directory (php) and then display them using a jquery galery plugin.

I was unable to run the galleryView after all the pictures were loaded by the client. The single way was to use a delay command.

I don´t have to tell the disadvantages of this method. Does anyone knows how to "correct" the script so that the gallery plugin is called after all the images are loaded?

<script type="text/javascript">
    $("document").ready(function() {
         $('#aa').load('get_fotos.php').delay(2000).queue(function() {
              $('#aa').galleryView({
                     panel_width: 800,
                     panel_height: 400,
                     show_filmstrip_nav: false,
                     enable_slideshow: false,
                     panel_animation: 'crossfade',
                     frame_opacity: 1,
                     show_infobar: false,
                     frame_width: 80,
                     frame_height: 40,
                     // frame_scale: 'fit',
                });
        });
    });
</script>

Thanks a lot

  • 写回答

1条回答 默认 最新

  • dongyou9721 2012-12-28 11:15
    关注

    You can check this out by this:

    It worked for me hope it helps.

    imageArray = new Array();
    
    imageArray[0] = 'image1.jpg'; // your image path
    imageArray[1] = 'image2.jpg'; // your image path
    htmldata='';
    count = 0;
    imgArray = new Array();
    
    $.each(imageArray, function(i,item){
        var image=new Image();
        $(image).bind("load", {}, function(event) {
            count++;
            imageArray[i] =  $(image).attr("src");
            if(count==2){
                $("#imageHolder").empty();
                $.each(imageArray, function(j,item){
                    htmldata = '<img id="image'+j+'" src="' + imageArray[j] +'" />';    //create ur image tag u need to call
                    $("#imageHolder").append(htmldata);
                });
    
                $('#aa').galleryView({//call your bind method for plug in
                });
            }
        });
        image.src = imageArray[i];
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 求解vmware的网络模式问题
  • ¥24 EFS加密后,在同一台电脑解密出错,证书界面找不到对应指纹的证书,未备份证书,求在原电脑解密的方法,可行即采纳
  • ¥15 springboot 3.0 实现Security 6.x版本集成
  • ¥15 PHP-8.1 镜像无法用dockerfile里的CMD命令启动 只能进入容器启动,如何解决?(操作系统-ubuntu)
  • ¥30 请帮我解决一下下面六个代码
  • ¥15 关于资源监视工具的e-care有知道的嘛
  • ¥35 MIMO天线稀疏阵列排布问题
  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?