Javascript jQuery横幅旋转器插件中的延迟设置不起作用

Javascript jQuery横幅旋转器插件中的延迟设置不起作用,javascript,jquery,jquery-plugins,Javascript,Jquery,Jquery Plugins,我正在使用一个很棒且灵活的jQuery横幅旋转器,但我需要修改它以从外部源加载幻灯片。我让外部源工作得很好,幻灯片加载也很好,但我似乎无法让它识别延迟设置 基本上,我修改了插件的启动方式,以便它加载我的外部内容,然后在使用幻灯片功能之前对其进行格式化 // Grabs data from Sphere Photo Gallery and formats the HTML for jQuery Banner Rotator plugin function sphereSlider(options)

我正在使用一个很棒且灵活的jQuery横幅旋转器,但我需要修改它以从外部源加载幻灯片。我让外部源工作得很好,幻灯片加载也很好,但我似乎无法让它识别延迟设置

基本上,我修改了插件的启动方式,以便它加载我的外部内容,然后在使用幻灯片功能之前对其进行格式化

// Grabs data from Sphere Photo Gallery and formats the HTML for jQuery Banner Rotator plugin
function sphereSlider(options) {
    $.get("PhotoGallery.aspx.htm",function(data){
        var html = '';
        $(data).find('#pg_summary img').each(function(i){
            var imgsrc = $(this).attr("src");
            html += "<li>";
            html += "<a href='"+imgsrc+"'><img src='"+imgsrc+"' border=0/></a>";
            html += "<div class='imgCaption'>";
            html += "<h1>"+$(data).find('#pg_summary .pg_title:eq('+i+')').html().replace("&nbsp;","")+"</h1>";
            html += "<a href='"+$(data).find('#pg_summary .pg_title:eq('+i+')').html().replace("&nbsp;","")+"'></a>";
            html += "<div class='slideDesc'>"+$(data).find('#pg_summary .pg_longdescriptor:eq('+i+')').html()+"</div>";
            html += "</div>";
            html += "</li>";
        });
        $('.thumbnails ul').html(html);
        $(".container").wtRotator(options);
    });
}
//从Sphere照片库获取数据,并格式化jQuery横幅旋转器插件的HTML
函数球体滑块(选项){
$.get(“PhotoGallery.aspx.htm”),函数(数据){
var html='';
$(数据)。查找(“#pg#u summary img”)。每个(函数(i){
var imgsrc=$(this.attr(“src”);
html+=“
  • ”; html+=“”; html+=“”; html+=“”+$(数据).find(“#pg_summary.pg_title:eq(“+i+”))).html().replace(“,”)+”; html+=“”; html+=“”+$(数据).find(‘#pg_summary.pg_longdescriptor:eq(‘+i+’)’).html()+“”; html+=“”; html+=“
  • ”; }); $('.thumbnails ul').html(html); $(“.container”).wtRotator(选项); }); }
    然后在html中,我像这样调用我的函数:

    <script type="text/javascript">
      $(document).ready(function() {
          sphereSlider({
          width:900,
          height:254,
          thumb_width:24,
            thumb_height:24,
          button_width:24,
          button_height:24,
          button_margin:5,
          auto_start:true,
          delay:5000,
          play_once:false,
          transition:"block.fade",
          transition_speed:800,
          auto_center:true,
          easing:"",
          cpanel_position:"inside",
          cpanel_align:"BR",
          timer_align:"top",
          display_thumbs:false,
          display_dbuttons:false,
          display_playbutton:false,
          display_thumbimg:false,
            display_side_buttons:true,
          display_numbers:false,
          display_timer:true,
          mouseover_select:false,
          mouseover_pause:true,
          cpanel_mouseover:false,
          text_mouseover:false,
          text_effect:"fade",
          text_sync:true,
          tooltip_type:"text",
          shuffle:false,
          block_size:75,
          vert_size:55,
          horz_size:50,
          block_delay:25,
          vstripe_delay:75,
          hstripe_delay:180     
        });
        }
      );
    </script>
    
    
    $(文档).ready(函数(){
    球滑块({
    宽度:900,
    身高:254,
    拇指宽度:24,
    拇指高度:24,
    按钮宽度:24,
    按钮高度:24,
    按钮_边距:5,
    自动启动:正确,
    延误:5000,
    玩一次:错,
    过渡:“阻挡。褪色”,
    转换速度:800,
    汽车中心:对,
    宽松:“,
    cpanel_位置:“内部”,
    cpanel_align:“BR”,
    计时器对齐:“顶部”,
    显示拇指:false,
    显示按钮:false,
    显示播放按钮:false,
    显示\u拇指img:false,
    显示侧边按钮:真,
    显示_编号:false,
    显示计时器:真,
    鼠标悬停选择:false,
    鼠标悬停:对,
    cpanel_mouseover:错误,
    text_mouseover:false,
    文字效果:“淡入淡出”,
    文本同步:真,
    工具提示类型:“文本”,
    洗牌:错,
    块大小:75,
    垂直尺寸:55,
    horz_尺寸:50,
    阻塞延迟:25,
    vstripe_延迟:75,
    hstripe_延迟:180
    });
    }
    );
    
    它应该可以工作,因为所有其他设置都可以工作。只是延迟时间设置不正确。任何帮助都将不胜感激。我已将完整的源代码上载到以进行故障排除


    谢谢

    我认为$。每个函数都是同步的,所以滑块是在所有图像输出到HTML之前创建的

    请尝试使用以下各项:

    $.get("PhotoGallery.aspx.htm",function(data){
        var lbls=$(data).find('#pg_summary img');
        var html = '';
        for (var i=0; i< lbls.length; i++ ){
            var imgsrc = $(lbls[i]).attr("src");
            html += "<li>";
            html += "<a href='"+imgsrc+"'><img src='"+imgsrc+"' border=0/></a>";
            html += "<div class='imgCaption'>";
            html += "<h1>"+$(data).find('#pg_summary .pg_title:eq('+i+')').html().replace("&nbsp;","")+"</h1>";
            html += "<a href='"+$(data).find('#pg_summary .pg_title:eq('+i+')').html().replace("&nbsp;","")+"'></a>";
            html += "<div class='slideDesc'>"+$(data).find('#pg_summary .pg_longdescriptor:eq('+i+')').html()+"</div>";
            html += "</div>";
            html += "</li>";
        }
        $('.thumbnails ul').html(html);
        $(".container").wtRotator(options);
    });
    
    $.get(“PhotoGallery.aspx.htm”),函数(数据){
    var lbls=$(数据).find('pg#u summary img');
    var html='';
    对于(变量i=0;i”;
    html+=“”;
    html+=“”;
    html+=“”+$(数据).find(“#pg_summary.pg_title:eq(“+i+”))).html().replace(“,”)+”;
    html+=“”;
    html+=“”+$(数据).find(‘#pg_summary.pg_longdescriptor:eq(‘+i+’)’).html()+“”;
    html+=“”;
    html+=“”;
    }
    $('.thumbnails ul').html(html);
    $(“.container”).wtRotator(选项);
    });
    
    您可以通过删除几个文本轻松解决此问题

    因为“js/jquery.wt rotator.js”中有一个错误的注释

    发件人:

    //Line: 1842
    //set delay
    //this._delay = this._$items[i].data("delay");
    
    致:


    并没有真正改变结果。幻灯片似乎忽略了延迟设置,并正确设置了所有其他设置。超级奇怪。仅供参考,我通过直接在其中编写图像html对图像进行了本地化,并剥离了sphereFunction,使其仅包含以下内容:
    函数sphereSlider(options){$(.container”).wtRotator(options);}
    因此我认为它在html
    $(document).ready(function(){sphereSlider({options};});
    我认为脚本的原始作者那样做只是为了让我觉得自己很笨。
    //set delay
    this._delay = this._$items[i].data("delay");