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];
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据